diff options
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 |