diff options
Diffstat (limited to 'spec/requests/api/graphql/ci/stages_spec.rb')
-rw-r--r-- | spec/requests/api/graphql/ci/stages_spec.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/requests/api/graphql/ci/stages_spec.rb b/spec/requests/api/graphql/ci/stages_spec.rb new file mode 100644 index 00000000000..cd48a24b9c8 --- /dev/null +++ b/spec/requests/api/graphql/ci/stages_spec.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true +require 'spec_helper' + +RSpec.describe 'Query.project.pipeline.stages' do + include GraphqlHelpers + + let(:project) { create(:project, :repository, :public) } + let(:user) { create(:user) } + let(:pipeline) { create(:ci_pipeline, project: project, user: user) } + let(:stage_graphql_data) { graphql_data['project']['pipeline']['stages'] } + + let(:params) { {} } + + let(:fields) do + <<~QUERY + nodes { + #{all_graphql_fields_for('CiStage')} + } + QUERY + end + + let(:query) do + %( + query { + project(fullPath: "#{project.full_path}") { + pipeline(iid: "#{pipeline.iid}") { + stages { + #{fields} + } + } + } + } + ) + end + + before do + create(:ci_stage_entity, pipeline: pipeline, name: 'deploy') + post_graphql(query, current_user: user) + end + + it_behaves_like 'a working graphql query' + + it 'returns the stage of a pipeline' do + expect(stage_graphql_data['nodes'].first['name']).to eq('deploy') + end +end |