diff options
Diffstat (limited to 'spec/finders/issues_finder_spec.rb')
-rw-r--r-- | spec/finders/issues_finder_spec.rb | 59 |
1 files changed, 40 insertions, 19 deletions
diff --git a/spec/finders/issues_finder_spec.rb b/spec/finders/issues_finder_spec.rb index 33b8a5954ae..b794ab626bf 100644 --- a/spec/finders/issues_finder_spec.rb +++ b/spec/finders/issues_finder_spec.rb @@ -179,33 +179,54 @@ RSpec.describe IssuesFinder do end end - context 'filtering by author ID' do - let(:params) { { author_id: user2.id } } + context 'filtering by author' do + context 'by author ID' do + let(:params) { { author_id: user2.id } } - it 'returns issues created by that user' do - expect(issues).to contain_exactly(issue3) + it 'returns issues created by that user' do + expect(issues).to contain_exactly(issue3) + end end - end - context 'filtering by not author ID' do - let(:params) { { not: { author_id: user2.id } } } + context 'using OR' do + let(:issue6) { create(:issue, project: project2) } + let(:params) { { or: { author_username: [issue3.author.username, issue6.author.username] } } } + + it 'returns issues created by any of the given users' do + expect(issues).to contain_exactly(issue3, issue6) + end + + context 'when feature flag is disabled' do + before do + stub_feature_flags(or_issuable_queries: false) + end - it 'returns issues not created by that user' do - expect(issues).to contain_exactly(issue1, issue2, issue4, issue5) + it 'does not add any filter' do + expect(issues).to contain_exactly(issue1, issue2, issue3, issue4, issue5, issue6) + end + end end - end - context 'filtering by nonexistent author ID and issue term using CTE for search' do - let(:params) do - { - author_id: 'does-not-exist', - search: 'git', - attempt_group_search_optimizations: true - } + context 'filtering by NOT author ID' do + let(:params) { { not: { author_id: user2.id } } } + + it 'returns issues not created by that user' do + expect(issues).to contain_exactly(issue1, issue2, issue4, issue5) + end end - it 'returns no results' do - expect(issues).to be_empty + context 'filtering by nonexistent author ID and issue term using CTE for search' do + let(:params) do + { + author_id: 'does-not-exist', + search: 'git', + attempt_group_search_optimizations: true + } + end + + it 'returns no results' do + expect(issues).to be_empty + end end end |