Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/helpers/notes_helper_spec.rb')
-rw-r--r--spec/helpers/notes_helper_spec.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/spec/helpers/notes_helper_spec.rb b/spec/helpers/notes_helper_spec.rb
index fc62bbf8bf8..913a38d353f 100644
--- a/spec/helpers/notes_helper_spec.rb
+++ b/spec/helpers/notes_helper_spec.rb
@@ -322,11 +322,21 @@ RSpec.describe NotesHelper do
describe '#notes_data' do
let(:issue) { create(:issue, project: project) }
- it 'sets last_fetched_at to 0 when start_at_zero is true' do
+ before do
@project = project
@noteable = issue
+ allow(helper).to receive(:current_user).and_return(guest)
+ end
+
+ it 'sets last_fetched_at to 0 when start_at_zero is true' do
expect(helper.notes_data(issue, true)[:lastFetchedAt]).to eq(0)
end
+
+ it 'includes the current notes filter for the user' do
+ guest.set_notes_filter(UserPreference::NOTES_FILTERS[:only_comments], issue)
+
+ expect(helper.notes_data(issue)[:notesFilter]).to eq(UserPreference::NOTES_FILTERS[:only_comments])
+ end
end
end