diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-20 14:18:08 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-20 14:18:08 +0300 |
commit | 5afcbe03ead9ada87621888a31a62652b10a7e4f (patch) | |
tree | 9918b67a0d0f0bafa6542e839a8be37adf73102d /spec/requests/api/graphql/mutations/ci/pipeline_trigger/create_spec.rb | |
parent | c97c0201564848c1f53226fe19d71fdcc472f7d0 (diff) |
Add latest changes from gitlab-org/gitlab@16-4-stable-eev16.4.0-rc42
Diffstat (limited to 'spec/requests/api/graphql/mutations/ci/pipeline_trigger/create_spec.rb')
-rw-r--r-- | spec/requests/api/graphql/mutations/ci/pipeline_trigger/create_spec.rb | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/spec/requests/api/graphql/mutations/ci/pipeline_trigger/create_spec.rb b/spec/requests/api/graphql/mutations/ci/pipeline_trigger/create_spec.rb index 1af12d51e1e..2711bb9a4bd 100644 --- a/spec/requests/api/graphql/mutations/ci/pipeline_trigger/create_spec.rb +++ b/spec/requests/api/graphql/mutations/ci/pipeline_trigger/create_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe 'PipelineTriggerCreate', feature_category: :continuous_integration do include GraphqlHelpers - let_it_be(:user) { create(:user) } + let_it_be(:current_user) { create(:user) } let_it_be_with_reload(:project) { create(:project) } let(:mutation) { graphql_mutation(:pipeline_trigger_create, params) } @@ -19,24 +19,15 @@ RSpec.describe 'PipelineTriggerCreate', feature_category: :continuous_integratio } end - subject { post_graphql_mutation(mutation, current_user: user) } + subject { post_graphql_mutation(mutation, current_user: current_user) } context 'when unauthorized' do - it 'returns an error' do - subject - - expect(graphql_errors).not_to be_empty - expect(graphql_errors[0]['message']) - .to eq( - "The resource that you are attempting to access does not exist " \ - "or you don't have permission to perform this action" - ) - end + it_behaves_like 'a mutation on an unauthorized resource' end context 'when authorized' do before_all do - project.add_owner(user) + project.add_owner(current_user) end context 'when the params are invalid' do @@ -60,9 +51,9 @@ RSpec.describe 'PipelineTriggerCreate', feature_category: :continuous_integratio expect(graphql_data_at(:pipeline_trigger_create, :pipeline_trigger)).to match a_hash_including( 'owner' => a_hash_including( - 'id' => user.to_global_id.to_s, - 'username' => user.username, - 'name' => user.name + 'id' => current_user.to_global_id.to_s, + 'username' => current_user.username, + 'name' => current_user.name ), 'description' => description, "canAccessProject" => true, |