diff options
Diffstat (limited to 'spec/finders/projects_finder_spec.rb')
-rw-r--r-- | spec/finders/projects_finder_spec.rb | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/spec/finders/projects_finder_spec.rb b/spec/finders/projects_finder_spec.rb index 364e5de4ece..b8b5e2c3bb7 100644 --- a/spec/finders/projects_finder_spec.rb +++ b/spec/finders/projects_finder_spec.rb @@ -137,9 +137,9 @@ RSpec.describe ProjectsFinder do end end - describe 'filter by tags' do + describe 'filter by tags (deprecated)' do before do - public_project.tag_list = 'foo' + public_project.topic_list = 'foo' public_project.save! end @@ -148,6 +148,37 @@ RSpec.describe ProjectsFinder do it { is_expected.to eq([public_project]) } end + describe 'filter by topics' do + before do + public_project.topic_list = 'foo, bar' + public_project.save! + end + + context 'single topic' do + let(:params) { { topic: 'foo' } } + + it { is_expected.to eq([public_project]) } + end + + context 'multiple topics' do + let(:params) { { topic: 'bar, foo' } } + + it { is_expected.to eq([public_project]) } + end + + context 'one topic matches, other one does not' do + let(:params) { { topic: 'foo, xyz' } } + + it { is_expected.to eq([]) } + end + + context 'no matching topic' do + let(:params) { { topic: 'xyz' } } + + it { is_expected.to eq([]) } + end + end + describe 'filter by personal' do let!(:personal_project) { create(:project, namespace: user.namespace) } let(:params) { { personal: true } } |