diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-20 15:40:28 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-20 15:40:28 +0000 |
commit | b595cb0c1dec83de5bdee18284abe86614bed33b (patch) | |
tree | 8c3d4540f193c5ff98019352f554e921b3a41a72 /spec/finders/projects_finder_spec.rb | |
parent | 2f9104a328fc8a4bddeaa4627b595166d24671d0 (diff) | |
download | gitlab-ce-b595cb0c1dec83de5bdee18284abe86614bed33b.tar.gz |
Add latest changes from gitlab-org/gitlab@15-2-stable-eev15.2.0-rc42
Diffstat (limited to 'spec/finders/projects_finder_spec.rb')
-rw-r--r-- | spec/finders/projects_finder_spec.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/finders/projects_finder_spec.rb b/spec/finders/projects_finder_spec.rb index d26180bbf94..3bef4d85b33 100644 --- a/spec/finders/projects_finder_spec.rb +++ b/spec/finders/projects_finder_spec.rb @@ -177,6 +177,35 @@ RSpec.describe ProjectsFinder do end end + describe 'filter by topic_id' do + let_it_be(:topic1) { create(:topic) } + let_it_be(:topic2) { create(:topic) } + + before do + public_project.reload + public_project.topics << topic1 + public_project.save! + end + + context 'topic with assigned projects' do + let(:params) { { topic_id: topic1.id } } + + it { is_expected.to eq([public_project]) } + end + + context 'topic without assigned projects' do + let(:params) { { topic_id: topic2.id } } + + it { is_expected.to eq([]) } + end + + context 'non-existing topic' do + let(:params) { { topic_id: non_existing_record_id } } + + it { is_expected.to eq([]) } + end + end + describe 'filter by personal' do let!(:personal_project) { create(:project, namespace: user.namespace) } let(:params) { { personal: true } } |