diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-05 03:09:38 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-05 03:09:38 +0300 |
commit | 2e74e7299b20e0c3d0c5c26e329ef26388abb9ca (patch) | |
tree | 66ec0d09fab0e944da690fa57ac960c1bf04a68d /spec/finders | |
parent | 568e9be84cf7850a478c67829439d0eac0341618 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/finders')
-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 } } |