summaryrefslogtreecommitdiff
path: root/spec/finders
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2019-02-25 11:00:24 +0000
committerRémy Coutable <remy@rymai.me>2019-02-26 12:24:39 +0100
commita555a227dd7a846e5b8e8c84839120d40f9d1090 (patch)
tree7834ad40f3da966653f7f5ed8a5bf0c118f0b1b1 /spec/finders
parentafd290a444d09e84092e5a5d738bcf28ec71f3c6 (diff)
downloadgitlab-ce-a555a227dd7a846e5b8e8c84839120d40f9d1090.tar.gz
Merge branch 'filter-confidential-issues' into 'master'
Ability to filter confidential issues Closes #50747 See merge request gitlab-org/gitlab-ce!24960
Diffstat (limited to 'spec/finders')
-rw-r--r--spec/finders/issues_finder_spec.rb28
1 files changed, 27 insertions, 1 deletions
diff --git a/spec/finders/issues_finder_spec.rb b/spec/finders/issues_finder_spec.rb
index fe8000e419b..47e2548c3d6 100644
--- a/spec/finders/issues_finder_spec.rb
+++ b/spec/finders/issues_finder_spec.rb
@@ -490,6 +490,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: true } }
+
+ 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: false } }
+
+ 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 }
@@ -556,7 +582,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