diff options
author | Robert Schilling <rschilling@student.tugraz.at> | 2019-02-08 22:43:48 +0300 |
---|---|---|
committer | Robert Schilling <rschilling@student.tugraz.at> | 2019-02-21 16:02:38 +0300 |
commit | 66c9a311cc1251d9046e4bb2936841a57bcd1c9c (patch) | |
tree | f44b499d19dc9ecf059432f459359cdceefc61ec /spec/finders/issues_finder_spec.rb | |
parent | bd9ae901ec0bc0f9d1060e9128ecd5f8d8127671 (diff) |
Add specs for filtering confidential issues
Diffstat (limited to 'spec/finders/issues_finder_spec.rb')
-rw-r--r-- | spec/finders/issues_finder_spec.rb | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/spec/finders/issues_finder_spec.rb b/spec/finders/issues_finder_spec.rb index 34cb09942be..77b669cfa35 100644 --- a/spec/finders/issues_finder_spec.rb +++ b/spec/finders/issues_finder_spec.rb @@ -460,6 +460,32 @@ describe IssuesFinder do end end + context 'filtering by confidential' do + set(:confidential_issue) { create(:issue, project: project1, confidential: true) } + + context 'no filtering' do + it 'returns all issues' do + expect(issues).to contain_exactly(issue1, issue2, issue3, issue4, confidential_issue) + end + end + + context 'user filters confidential issues' do + let(:params) { { confidential: 'yes' } } + + it 'returns only confdential issues' do + expect(issues).to contain_exactly(confidential_issue) + end + end + + context 'user filters only public issues' do + let(:params) { { confidential: 'no' } } + + it 'returns only confdential issues' do + expect(issues).to contain_exactly(issue1, issue2, issue3, issue4) + end + end + end + context 'when the user is unauthorized' do let(:search_user) { nil } @@ -526,7 +552,7 @@ describe IssuesFinder do it 'returns the number of rows for the default state' do finder = described_class.new(user) - expect(finder.row_count).to eq(4) + expect(finder.row_count).to eq(5) end it 'returns the number of rows for a given state' do |