diff options
author | Felipe Artur <fcardozo@gitlab.com> | 2018-11-05 15:30:14 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-11-05 15:30:14 +0300 |
commit | b4d005eb7b4a51e8cf6b11e6aea3d0c264e4abfd (patch) | |
tree | 2d073cb044761fce0a08ca375b195e12836c985b /spec/support | |
parent | 90473e064eac21be283e751005e0c7abbdbf9089 (diff) |
Add 'only history' option to notes filter
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/shared_examples/controllers/issuable_notes_filter_shared_examples.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/spec/support/shared_examples/controllers/issuable_notes_filter_shared_examples.rb b/spec/support/shared_examples/controllers/issuable_notes_filter_shared_examples.rb index 9c9d7ad781e..95e69328080 100644 --- a/spec/support/shared_examples/controllers/issuable_notes_filter_shared_examples.rb +++ b/spec/support/shared_examples/controllers/issuable_notes_filter_shared_examples.rb @@ -34,12 +34,24 @@ shared_examples 'issuable notes filter' do expect(user.reload.notes_filter_for(issuable)).to eq(0) end - it 'returns no system note' do + it 'returns only user comments' do user.set_notes_filter(UserPreference::NOTES_FILTERS[:only_comments], issuable) get :discussions, namespace_id: project.namespace, project_id: project, id: issuable.iid + discussions = JSON.parse(response.body) - expect(JSON.parse(response.body).count).to eq(1) + expect(discussions.count).to eq(1) + expect(discussions.first["notes"].first["system"]).to be(false) + end + + it 'returns only activity notes' do + user.set_notes_filter(UserPreference::NOTES_FILTERS[:only_activity], issuable) + + get :discussions, namespace_id: project.namespace, project_id: project, id: issuable.iid + discussions = JSON.parse(response.body) + + expect(discussions.count).to eq(1) + expect(discussions.first["notes"].first["system"]).to be(true) end context 'when filter is set to "only_comments"' do |