diff options
Diffstat (limited to 'spec/frontend/fixtures/pipeline_header.rb')
-rw-r--r-- | spec/frontend/fixtures/pipeline_header.rb | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/spec/frontend/fixtures/pipeline_header.rb b/spec/frontend/fixtures/pipeline_header.rb index 744df18a403..77d626100ad 100644 --- a/spec/frontend/fixtures/pipeline_header.rb +++ b/spec/frontend/fixtures/pipeline_header.rb @@ -18,18 +18,23 @@ RSpec.describe "GraphQL Pipeline Header", '(JavaScript fixtures)', type: :reques let_it_be(:pipeline) do create( :ci_pipeline, + :merged_result_pipeline, project: project, sha: commit.id, ref: 'master', user: user, + name: 'Build pipeline', status: :success, duration: 7210, created_at: 2.hours.ago, started_at: 1.hour.ago, - finished_at: Time.current + finished_at: Time.current, + source: :schedule ) end + let_it_be(:builds) { create_list(:ci_build, 3, :success, pipeline: pipeline, ref: 'master') } + it "graphql/pipelines/pipeline_header_success.json" do query = get_graphql_query_as_string(query_path) @@ -64,6 +69,34 @@ RSpec.describe "GraphQL Pipeline Header", '(JavaScript fixtures)', type: :reques end end + context 'with running pipeline and no permissions' do + let_it_be(:pipeline) do + create( + :ci_pipeline, + project: project, + sha: commit.id, + ref: 'master', + user: user, + status: :running, + created_at: 2.hours.ago, + started_at: 1.hour.ago + ) + end + + let_it_be(:build) { create(:ci_build, :running, pipeline: pipeline, ref: 'master') } + + it "graphql/pipelines/pipeline_header_running_no_permissions.json" do + guest = create(:user) + project.add_guest(guest) + + query = get_graphql_query_as_string(query_path) + + post_graphql(query, current_user: guest, variables: { fullPath: project.full_path, iid: pipeline.iid }) + + expect_graphql_errors_to_be_empty + end + end + context 'with running pipeline and duration' do let_it_be(:pipeline) do create( |