diff options
Diffstat (limited to 'spec/requests')
14 files changed, 145 insertions, 127 deletions
diff --git a/spec/requests/api/graphql/mutations/admin/sidekiq_queues/delete_jobs_spec.rb b/spec/requests/api/graphql/mutations/admin/sidekiq_queues/delete_jobs_spec.rb index b3d25155a6f..316b0f3755d 100644 --- a/spec/requests/api/graphql/mutations/admin/sidekiq_queues/delete_jobs_spec.rb +++ b/spec/requests/api/graphql/mutations/admin/sidekiq_queues/delete_jobs_spec.rb @@ -20,7 +20,7 @@ RSpec.describe 'Deleting Sidekiq jobs', :clean_gitlab_redis_queues, feature_cate let(:current_user) { create(:user) } it_behaves_like 'a mutation that returns top-level errors', - errors: ['You must be an admin to use this mutation'] + errors: ['You must be an admin to use this mutation'] end context 'when the user is an admin' do @@ -51,9 +51,7 @@ RSpec.describe 'Deleting Sidekiq jobs', :clean_gitlab_redis_queues, feature_cate post_graphql_mutation(mutation, current_user: admin) expect(mutation_response['errors']).to be_empty - expect(mutation_response['result']).to eq('completed' => true, - 'deletedJobs' => 2, - 'queueSize' => 1) + expect(mutation_response['result']).to eq('completed' => true, 'deletedJobs' => 2, 'queueSize' => 1) end end @@ -61,14 +59,14 @@ RSpec.describe 'Deleting Sidekiq jobs', :clean_gitlab_redis_queues, feature_cate let(:variables) { { queue_name: queue } } it_behaves_like 'a mutation that returns errors in the response', - errors: ['No metadata provided'] + errors: ['No metadata provided'] end context 'when the queue does not exist' do let(:variables) { { user: admin.username, queue_name: 'authorized_projects_2' } } it_behaves_like 'a mutation that returns top-level errors', - errors: ['Queue authorized_projects_2 not found'] + errors: ['Queue authorized_projects_2 not found'] end end end diff --git a/spec/requests/api/graphql/mutations/alert_management/alerts/create_alert_issue_spec.rb b/spec/requests/api/graphql/mutations/alert_management/alerts/create_alert_issue_spec.rb index fbe6d95dfff..f2b516783e5 100644 --- a/spec/requests/api/graphql/mutations/alert_management/alerts/create_alert_issue_spec.rb +++ b/spec/requests/api/graphql/mutations/alert_management/alerts/create_alert_issue_spec.rb @@ -14,21 +14,23 @@ RSpec.describe 'Create an alert issue from an alert', feature_category: :inciden project_path: project.full_path, iid: alert.iid.to_s } - graphql_mutation(:create_alert_issue, variables, - <<~QL - clientMutationId - errors - alert { - iid - issue { - iid - } - } - issue { - iid - title - } - QL + graphql_mutation( + :create_alert_issue, + variables, + <<~QL + clientMutationId + errors + alert { + iid + issue { + iid + } + } + issue { + iid + title + } + QL ) end diff --git a/spec/requests/api/graphql/mutations/boards/issues/issue_move_list_spec.rb b/spec/requests/api/graphql/mutations/boards/issues/issue_move_list_spec.rb index df64caa1cfb..8e71d77f7bc 100644 --- a/spec/requests/api/graphql/mutations/boards/issues/issue_move_list_spec.rb +++ b/spec/requests/api/graphql/mutations/boards/issues/issue_move_list_spec.rb @@ -131,22 +131,24 @@ RSpec.describe 'Reposition and move issue within board lists', feature_category: end def mutation(additional_params = {}) - graphql_mutation(mutation_name, issue_move_params.merge(additional_params), - <<-QL.strip_heredoc - clientMutationId - issue { - iid, - relativePosition - labels { - edges { - node{ - title - } - } - } - } - errors - QL + graphql_mutation( + mutation_name, + issue_move_params.merge(additional_params), + <<-QL.strip_heredoc + clientMutationId + issue { + iid, + relativePosition + labels { + edges { + node{ + title + } + } + } + } + errors + QL ) end end diff --git a/spec/requests/api/graphql/mutations/ci/pipeline_retry_spec.rb b/spec/requests/api/graphql/mutations/ci/pipeline_retry_spec.rb index e7edc86bea0..70b154946ef 100644 --- a/spec/requests/api/graphql/mutations/ci/pipeline_retry_spec.rb +++ b/spec/requests/api/graphql/mutations/ci/pipeline_retry_spec.rb @@ -13,13 +13,15 @@ RSpec.describe 'PipelineRetry', feature_category: :continuous_integration do variables = { id: pipeline.to_global_id.to_s } - graphql_mutation(:pipeline_retry, variables, - <<-QL - errors - pipeline { - id - } - QL + graphql_mutation( + :pipeline_retry, + variables, + <<-QL + errors + pipeline { + id + } + QL ) end diff --git a/spec/requests/api/graphql/mutations/clusters/agent_tokens/agent_tokens/create_spec.rb b/spec/requests/api/graphql/mutations/clusters/agent_tokens/agent_tokens/create_spec.rb index ef0d44395bf..dd4b015409b 100644 --- a/spec/requests/api/graphql/mutations/clusters/agent_tokens/agent_tokens/create_spec.rb +++ b/spec/requests/api/graphql/mutations/clusters/agent_tokens/agent_tokens/create_spec.rb @@ -23,8 +23,8 @@ RSpec.describe 'Create a new cluster agent token', feature_category: :deployment context 'without user permissions' do it_behaves_like 'a mutation that returns top-level errors', - errors: ["The resource that you are attempting to access does not exist "\ - "or you don't have permission to perform this action"] + errors: ["The resource that you are attempting to access does not exist "\ + "or you don't have permission to perform this action"] it 'does not create a token' do expect { post_graphql_mutation(mutation, current_user: current_user) }.not_to change(Clusters::AgentToken, :count) diff --git a/spec/requests/api/graphql/mutations/clusters/agents/delete_spec.rb b/spec/requests/api/graphql/mutations/clusters/agents/delete_spec.rb index b70a6282a7a..a2a093d63e6 100644 --- a/spec/requests/api/graphql/mutations/clusters/agents/delete_spec.rb +++ b/spec/requests/api/graphql/mutations/clusters/agents/delete_spec.rb @@ -22,8 +22,8 @@ RSpec.describe 'Delete a cluster agent', feature_category: :deployment_managemen context 'without project permissions' do it_behaves_like 'a mutation that returns top-level errors', - errors: ['The resource that you are attempting to access does not exist '\ - 'or you don\'t have permission to perform this action'] + errors: ['The resource that you are attempting to access does not exist '\ + 'or you don\'t have permission to perform this action'] it 'does not delete cluster agent' do expect { cluster_agent.reload }.not_to raise_error diff --git a/spec/requests/api/graphql/mutations/merge_requests/reviewer_rereview_spec.rb b/spec/requests/api/graphql/mutations/merge_requests/reviewer_rereview_spec.rb index 7a1b3982111..ec82941b094 100644 --- a/spec/requests/api/graphql/mutations/merge_requests/reviewer_rereview_spec.rb +++ b/spec/requests/api/graphql/mutations/merge_requests/reviewer_rereview_spec.rb @@ -16,11 +16,13 @@ RSpec.describe 'Setting assignees of a merge request', feature_category: :code_r project_path: project.full_path, iid: merge_request.iid.to_s } - graphql_mutation(:merge_request_reviewer_rereview, variables.merge(input), - <<-QL.strip_heredoc - clientMutationId - errors - QL + graphql_mutation( + :merge_request_reviewer_rereview, + variables.merge(input), + <<-QL.strip_heredoc + clientMutationId + errors + QL ) end diff --git a/spec/requests/api/graphql/mutations/merge_requests/set_assignees_spec.rb b/spec/requests/api/graphql/mutations/merge_requests/set_assignees_spec.rb index 4a7d1083f2e..cb7bac771b3 100644 --- a/spec/requests/api/graphql/mutations/merge_requests/set_assignees_spec.rb +++ b/spec/requests/api/graphql/mutations/merge_requests/set_assignees_spec.rb @@ -21,19 +21,21 @@ RSpec.describe 'Setting assignees of a merge request', :assume_throttled, featur project_path: project.full_path, iid: merge_request.iid.to_s } - graphql_mutation(:merge_request_set_assignees, variables.merge(input), - <<-QL.strip_heredoc - clientMutationId - errors - mergeRequest { - id - assignees { - nodes { - username - } - } - } - QL + graphql_mutation( + :merge_request_set_assignees, + variables.merge(input), + <<-QL.strip_heredoc + clientMutationId + errors + mergeRequest { + id + assignees { + nodes { + username + } + } + } + QL ) end diff --git a/spec/requests/api/graphql/mutations/merge_requests/set_draft_spec.rb b/spec/requests/api/graphql/mutations/merge_requests/set_draft_spec.rb index 0c2e2975350..a2c5c235d25 100644 --- a/spec/requests/api/graphql/mutations/merge_requests/set_draft_spec.rb +++ b/spec/requests/api/graphql/mutations/merge_requests/set_draft_spec.rb @@ -15,15 +15,17 @@ RSpec.describe 'Setting Draft status of a merge request', feature_category: :cod project_path: project.full_path, iid: merge_request.iid.to_s } - graphql_mutation(:merge_request_set_draft, variables.merge(input), - <<-QL.strip_heredoc - clientMutationId - errors - mergeRequest { - id - title - } - QL + graphql_mutation( + :merge_request_set_draft, + variables.merge(input), + <<-QL.strip_heredoc + clientMutationId + errors + mergeRequest { + id + title + } + QL ) end diff --git a/spec/requests/api/graphql/mutations/merge_requests/set_labels_spec.rb b/spec/requests/api/graphql/mutations/merge_requests/set_labels_spec.rb index e40a3cf7ce9..4ddd10b1734 100644 --- a/spec/requests/api/graphql/mutations/merge_requests/set_labels_spec.rb +++ b/spec/requests/api/graphql/mutations/merge_requests/set_labels_spec.rb @@ -17,19 +17,21 @@ RSpec.describe 'Setting labels of a merge request' do project_path: project.full_path, iid: merge_request.iid.to_s } - graphql_mutation(:merge_request_set_labels, variables.merge(input), - <<-QL.strip_heredoc - clientMutationId - errors - mergeRequest { - id - labels { - nodes { - id - } - } - } - QL + graphql_mutation( + :merge_request_set_labels, + variables.merge(input), + <<-QL.strip_heredoc + clientMutationId + errors + mergeRequest { + id + labels { + nodes { + id + } + } + } + QL ) end diff --git a/spec/requests/api/graphql/mutations/merge_requests/set_locked_spec.rb b/spec/requests/api/graphql/mutations/merge_requests/set_locked_spec.rb index 73a38adf723..a6ddb9beb5c 100644 --- a/spec/requests/api/graphql/mutations/merge_requests/set_locked_spec.rb +++ b/spec/requests/api/graphql/mutations/merge_requests/set_locked_spec.rb @@ -15,15 +15,17 @@ RSpec.describe 'Setting locked status of a merge request', feature_category: :co project_path: project.full_path, iid: merge_request.iid.to_s } - graphql_mutation(:merge_request_set_locked, variables.merge(input), - <<-QL.strip_heredoc - clientMutationId - errors - mergeRequest { - id - discussionLocked - } - QL + graphql_mutation( + :merge_request_set_locked, + variables.merge(input), + <<-QL.strip_heredoc + clientMutationId + errors + mergeRequest { + id + discussionLocked + } + QL ) end diff --git a/spec/requests/api/graphql/mutations/merge_requests/set_milestone_spec.rb b/spec/requests/api/graphql/mutations/merge_requests/set_milestone_spec.rb index 1898ee5a62d..9debfbd474b 100644 --- a/spec/requests/api/graphql/mutations/merge_requests/set_milestone_spec.rb +++ b/spec/requests/api/graphql/mutations/merge_requests/set_milestone_spec.rb @@ -16,17 +16,19 @@ RSpec.describe 'Setting milestone of a merge request', feature_category: :code_r project_path: project.full_path, iid: merge_request.iid.to_s } - graphql_mutation(:merge_request_set_milestone, variables.merge(input), - <<-QL.strip_heredoc - clientMutationId - errors - mergeRequest { - id - milestone { - id - } - } - QL + graphql_mutation( + :merge_request_set_milestone, + variables.merge(input), + <<-QL.strip_heredoc + clientMutationId + errors + mergeRequest { + id + milestone { + id + } + } + QL ) end diff --git a/spec/requests/api/graphql/mutations/merge_requests/set_reviewers_spec.rb b/spec/requests/api/graphql/mutations/merge_requests/set_reviewers_spec.rb index fd87112be33..c9efba689c2 100644 --- a/spec/requests/api/graphql/mutations/merge_requests/set_reviewers_spec.rb +++ b/spec/requests/api/graphql/mutations/merge_requests/set_reviewers_spec.rb @@ -21,19 +21,21 @@ RSpec.describe 'Setting reviewers of a merge request', :assume_throttled, featur project_path: project.full_path, iid: merge_request.iid.to_s } - graphql_mutation(:merge_request_set_reviewers, variables.merge(input), - <<-QL.strip_heredoc - clientMutationId - errors - mergeRequest { - id - reviewers { - nodes { - username - } - } - } - QL + graphql_mutation( + :merge_request_set_reviewers, + variables.merge(input), + <<-QL.strip_heredoc + clientMutationId + errors + mergeRequest { + id + reviewers { + nodes { + username + } + } + } + QL ) end diff --git a/spec/requests/jwt_controller_spec.rb b/spec/requests/jwt_controller_spec.rb index 0ac059b5ed3..966cc2d6d4e 100644 --- a/spec/requests/jwt_controller_spec.rb +++ b/spec/requests/jwt_controller_spec.rb @@ -92,7 +92,7 @@ RSpec.describe JwtController, feature_category: :system_access do context 'project with enabled CI' do subject! { get '/jwt/auth', params: parameters, headers: headers } - it { expect(service_class).to have_received(:new).with(project, user, ActionController::Parameters.new(parameters.merge(auth_type: :build, raw_token: build.token)).permit!) } + it { expect(service_class).to have_received(:new).with(project, user, ActionController::Parameters.new(parameters.merge(auth_type: :build)).permit!) } it_behaves_like 'user logging' end @@ -119,7 +119,7 @@ RSpec.describe JwtController, feature_category: :system_access do .with( nil, nil, - ActionController::Parameters.new(parameters.merge(deploy_token: deploy_token, auth_type: :deploy_token, raw_token: deploy_token.token)).permit! + ActionController::Parameters.new(parameters.merge(deploy_token: deploy_token, auth_type: :deploy_token)).permit! ) end @@ -144,7 +144,7 @@ RSpec.describe JwtController, feature_category: :system_access do .with( nil, user, - ActionController::Parameters.new(parameters.merge(auth_type: :personal_access_token, raw_token: pat.token)).permit! + ActionController::Parameters.new(parameters.merge(auth_type: :personal_access_token)).permit! ) end @@ -160,7 +160,7 @@ RSpec.describe JwtController, feature_category: :system_access do subject! { get '/jwt/auth', params: parameters, headers: headers } - it { expect(service_class).to have_received(:new).with(nil, user, ActionController::Parameters.new(parameters.merge(auth_type: :gitlab_or_ldap, raw_token: user.password)).permit!) } + it { expect(service_class).to have_received(:new).with(nil, user, ActionController::Parameters.new(parameters.merge(auth_type: :gitlab_or_ldap)).permit!) } it_behaves_like 'rejecting a blocked user' @@ -180,7 +180,7 @@ RSpec.describe JwtController, feature_category: :system_access do ActionController::Parameters.new({ service: service_name, scopes: %w[scope1 scope2] }).permit! end - it { expect(service_class).to have_received(:new).with(nil, user, service_parameters.merge(auth_type: :gitlab_or_ldap, raw_token: user.password)) } + it { expect(service_class).to have_received(:new).with(nil, user, service_parameters.merge(auth_type: :gitlab_or_ldap)) } it_behaves_like 'user logging' end @@ -197,7 +197,7 @@ RSpec.describe JwtController, feature_category: :system_access do ActionController::Parameters.new({ service: service_name, scopes: %w[scope1 scope2] }).permit! end - it { expect(service_class).to have_received(:new).with(nil, user, service_parameters.merge(auth_type: :gitlab_or_ldap, raw_token: user.password)) } + it { expect(service_class).to have_received(:new).with(nil, user, service_parameters.merge(auth_type: :gitlab_or_ldap)) } end context 'when user has 2FA enabled' do |