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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
035453e3
Commit
035453e3
authored
Jul 23, 2020
by
Alexandru Croitor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spec for case when start_at param not provided or nil
parent
ea90cf7c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
6 deletions
+37
-6
app/graphql/mutations/jira_import/import_users.rb
app/graphql/mutations/jira_import/import_users.rb
+1
-1
spec/requests/api/graphql/mutations/jira_import/import_users_spec.rb
...ts/api/graphql/mutations/jira_import/import_users_spec.rb
+36
-5
No files found.
app/graphql/mutations/jira_import/import_users.rb
View file @
035453e3
...
...
@@ -22,7 +22,7 @@ module Mutations
def
resolve
(
project_path
:,
start_at:
0
)
project
=
authorized_find!
(
full_path:
project_path
)
service_response
=
::
JiraImport
::
UsersImporter
.
new
(
context
[
:current_user
],
project
,
start_at
).
execute
service_response
=
::
JiraImport
::
UsersImporter
.
new
(
context
[
:current_user
],
project
,
start_at
.
to_i
).
execute
{
jira_users:
service_response
.
payload
,
...
...
spec/requests/api/graphql/mutations/jira_import/import_users_spec.rb
View file @
035453e3
...
...
@@ -8,15 +8,17 @@ RSpec.describe 'Importing Jira Users' do
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
)
}
let
(
:importer
)
{
instance_double
(
JiraImport
::
UsersImporter
)
}
let
(
:project_path
)
{
project
.
full_path
}
let
(
:start_at
)
{
7
}
let
(
:mutation
)
do
variables
=
{
let
(
:variables
)
do
{
start_at:
start_at
,
project_path:
project_path
}
end
let
(
:mutation
)
do
graphql_mutation
(
:jira_import_users
,
variables
)
end
...
...
@@ -65,9 +67,38 @@ RSpec.describe 'Importing Jira Users' do
end
end
context
'when all params and permissions are ok'
do
let
(
:importer
)
{
instance_double
(
JiraImport
::
UsersImporter
)
}
context
'with start_at'
do
RSpec
.
shared_examples
'start users import at zero'
do
it
'returns imported users'
do
users
=
[{
jira_account_id:
'12a'
,
jira_display_name:
'user 1'
}]
result
=
ServiceResponse
.
success
(
payload:
users
)
expect
(
importer
).
to
receive
(
:execute
).
and_return
(
result
)
expect
(
JiraImport
::
UsersImporter
).
to
receive
(
:new
).
with
(
current_user
,
project
,
0
).
and_return
(
importer
)
post_graphql_mutation
(
mutation
,
current_user:
current_user
)
end
end
context
'when nil'
do
let
(
:variables
)
do
{
start_at:
nil
,
project_path:
project_path
}
end
it_behaves_like
'start users import at zero'
end
context
'when not provided'
do
let
(
:variables
)
{
{
project_path:
project_path
}
}
it_behaves_like
'start users import at zero'
end
end
context
'when all params and permissions are ok'
do
before
do
expect
(
JiraImport
::
UsersImporter
).
to
receive
(
:new
).
with
(
current_user
,
project
,
7
)
.
and_return
(
importer
)
...
...
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