Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
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.rb23
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,