blob: cd48a24b9c8b5aa746b71a29140b1a36727bfab3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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
|