diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
commit | 0653e08efd039a5905f3fa4f6e9cef9f5d2f799c (patch) | |
tree | 4dcc884cf6d81db44adae4aa99f8ec1233a41f55 /spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb | |
parent | 744144d28e3e7fddc117924fef88de5d9674fe4c (diff) |
Add latest changes from gitlab-org/gitlab@14-3-stable-eev14.3.0-rc42
Diffstat (limited to 'spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb')
-rw-r--r-- | spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb b/spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb index 6f6855c8f84..865e892b12d 100644 --- a/spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb +++ b/spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb @@ -27,7 +27,7 @@ RSpec.describe ResolvesPipelines do project.add_developer(current_user) end - it { is_expected.to have_graphql_arguments(:status, :ref, :sha) } + it { is_expected.to have_graphql_arguments(:status, :ref, :sha, :source) } it 'finds all pipelines' do expect(resolve_pipelines).to contain_exactly(pipeline, failed_pipeline, ref_pipeline, sha_pipeline) @@ -45,6 +45,30 @@ RSpec.describe ResolvesPipelines do expect(resolve_pipelines(sha: 'deadbeef')).to contain_exactly(sha_pipeline) end + context 'filtering by source' do + let_it_be(:source_pipeline) { create(:ci_pipeline, project: project, source: 'web') } + + context 'when `dast_view_scans` feature flag is disabled' do + before do + stub_feature_flags(dast_view_scans: false) + end + + it 'does not filter by source' do + expect(resolve_pipelines(source: 'web')).to contain_exactly(pipeline, failed_pipeline, ref_pipeline, sha_pipeline, source_pipeline) + end + end + + context 'when `dast_view_scans` feature flag is enabled' do + it 'does filter by source' do + expect(resolve_pipelines(source: 'web')).to contain_exactly(source_pipeline) + end + + it 'returns all the pipelines' do + expect(resolve_pipelines).to contain_exactly(pipeline, failed_pipeline, ref_pipeline, sha_pipeline, source_pipeline) + end + end + end + it 'does not return any pipelines if the user does not have access' do expect(resolve_pipelines({}, {})).to be_empty end |