Commit 66c9a311 authored by Robert Schilling's avatar Robert Schilling

Add specs for filtering confidential issues

parent bd9ae901
...@@ -119,6 +119,15 @@ describe 'Dropdown hint', :js do ...@@ -119,6 +119,15 @@ describe 'Dropdown hint', :js do
expect_tokens([{ name: 'my-reaction' }]) expect_tokens([{ name: 'my-reaction' }])
expect_filtered_search_input_empty expect_filtered_search_input_empty
end end
it 'opens the yes-no dropdown when you click on confidential' do
click_hint('confidential')
expect(page).to have_css(js_dropdown_hint, visible: false)
expect(page).to have_css('#js-dropdown-confidential', visible: true)
expect_tokens([{ name: 'confidential' }])
expect_filtered_search_input_empty
end
end end
describe 'selecting from dropdown with some input' do describe 'selecting from dropdown with some input' do
......
...@@ -460,6 +460,32 @@ describe IssuesFinder do ...@@ -460,6 +460,32 @@ describe IssuesFinder do
end end
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 context 'when the user is unauthorized' do
let(:search_user) { nil } let(:search_user) { nil }
...@@ -526,7 +552,7 @@ describe IssuesFinder do ...@@ -526,7 +552,7 @@ describe IssuesFinder do
it 'returns the number of rows for the default state' do it 'returns the number of rows for the default state' do
finder = described_class.new(user) finder = described_class.new(user)
expect(finder.row_count).to eq(4) expect(finder.row_count).to eq(5)
end end
it 'returns the number of rows for a given state' do it 'returns the number of rows for a given state' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment