diff options
Diffstat (limited to 'spec/finders/ci/pipelines_finder_spec.rb')
-rw-r--r-- | spec/finders/ci/pipelines_finder_spec.rb | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/spec/finders/ci/pipelines_finder_spec.rb b/spec/finders/ci/pipelines_finder_spec.rb index 908210e0296..a2e8fe8df5a 100644 --- a/spec/finders/ci/pipelines_finder_spec.rb +++ b/spec/finders/ci/pipelines_finder_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe Ci::PipelinesFinder do - let(:project) { create(:project, :public, :repository) } + let_it_be(:project) { create(:project, :public, :repository) } let(:current_user) { nil } let(:params) { {} } @@ -242,6 +242,45 @@ RSpec.describe Ci::PipelinesFinder do end end + context 'when name is specified' do + let_it_be(:pipeline) { create(:ci_pipeline, project: project, name: 'Build pipeline') } + let_it_be(:pipeline_other) { create(:ci_pipeline, project: project, name: 'Some other pipeline') } + + let(:params) { { name: 'build Pipeline' } } + + it 'performs case insensitive compare' do + is_expected.to contain_exactly(pipeline) + end + + context 'when name does not exist' do + let(:params) { { name: 'absent-name' } } + + it 'returns empty' do + is_expected.to be_empty + end + end + + context 'when pipeline_name feature flag is off' do + before do + stub_feature_flags(pipeline_name: false) + end + + it 'ignores name parameter' do + is_expected.to contain_exactly(pipeline, pipeline_other) + end + end + + context 'when pipeline_name_search feature flag is off' do + before do + stub_feature_flags(pipeline_name_search: false) + end + + it 'ignores name parameter' do + is_expected.to contain_exactly(pipeline, pipeline_other) + end + end + end + describe 'ordering' do using RSpec::Parameterized::TableSyntax |