Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
d9564ed7
Commit
d9564ed7
authored
Jul 11, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spec for GitLab.com importer
parent
a14ee9be
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
0 deletions
+48
-0
spec/lib/gitlab/gitlab_import/importer_spec.rb
spec/lib/gitlab/gitlab_import/importer_spec.rb
+48
-0
No files found.
spec/lib/gitlab/gitlab_import/importer_spec.rb
0 → 100644
View file @
d9564ed7
require
'spec_helper'
describe
Gitlab
::
GitlabImport
::
Importer
,
lib:
true
do
describe
'#execute'
do
it
'persists issues'
do
stub_request
(
'issues'
,
[
{
'id'
=>
2579857
,
'iid'
=>
3
,
'title'
=>
'Issue'
,
'description'
=>
'Lorem ipsum'
,
'state'
=>
'opened'
,
'author'
=>
{
'id'
=>
283999
,
'name'
=>
'John Doe'
}
}
])
stub_request
(
'issues/2579857/notes'
,
[])
project
=
create
(
:empty_project
,
import_source:
'asd/vim'
)
project
.
build_import_data
(
credentials:
{
password:
'password'
})
subject
=
described_class
.
new
(
project
)
subject
.
execute
expected_attributes
=
{
iid:
3
,
title:
'Issue'
,
description:
"*Created by: John Doe*
\n\n
Lorem ipsum"
,
state:
'opened'
,
author_id:
project
.
creator_id
}
expect
(
project
.
issues
.
first
).
to
have_attributes
(
expected_attributes
)
end
def
stub_request
(
path
,
body
)
url
=
"https://gitlab.com/api/v3/projects/asd%2Fvim/
#{
path
}
?page=1&per_page=100"
WebMock
.
stub_request
(
:get
,
url
).
to_return
(
headers:
{
'Content-Type'
=>
'application/json'
},
body:
body
)
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment