diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-29 22:57:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-29 22:57:17 +0300 |
commit | 37e3c3bb33c3d331fceb2840cf3c1d3c466dcfa9 (patch) | |
tree | 9d3739f627b491b42ede6424acd11b589beed25f /spec/requests/api/graphql | |
parent | b55baf593e63db9be3f446ea0cca0281a69dd2e2 (diff) |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/requests/api/graphql')
-rw-r--r-- | spec/requests/api/graphql/mutations/jira_import/import_users_spec.rb | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/spec/requests/api/graphql/mutations/jira_import/import_users_spec.rb b/spec/requests/api/graphql/mutations/jira_import/import_users_spec.rb index 4057aa4ba9e..00b93984f98 100644 --- a/spec/requests/api/graphql/mutations/jira_import/import_users_spec.rb +++ b/spec/requests/api/graphql/mutations/jira_import/import_users_spec.rb @@ -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) |