blob: 64d9d9a78b4b6d1ce049f05fd25d1a155a522994 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# frozen_string_literal: true
require 'spec_helper'
describe UserPreference do
describe '#set_notes_filter' do
let(:issuable) { build_stubbed(:issue) }
let(:user_preference) { create(:user_preference) }
let(:only_comments) { described_class::NOTES_FILTERS[:only_comments] }
it 'returns updated discussion filter' do
filter_name =
user_preference.set_notes_filter(only_comments, issuable)
expect(filter_name).to eq(only_comments)
end
it 'updates discussion filter for issuable class' do
user_preference.set_notes_filter(only_comments, issuable)
expect(user_preference.reload.issue_notes_filter).to eq(only_comments)
end
context 'when notes_filter parameter is invalid' do
it 'returns the current notes filter' do
user_preference.set_notes_filter(only_comments, issuable)
expect(user_preference.set_notes_filter(9999, issuable)).to eq(only_comments)
end
end
end
end
|