FIX: Don't show liked consolidated notification when frequency is never.

This commit is contained in:
Guo Xiang Tan
2019-01-16 17:08:59 +08:00
parent 0b47ef6e86
commit f06b773d25
2 changed files with 29 additions and 1 deletions

View File

@ -303,6 +303,10 @@ describe Notification do
fab(Notification.types[:liked], true)
end
def liked_consolidated
fab(Notification.types[:liked_consolidated], true)
end
it 'correctly finds visible notifications' do
pm
expect(Notification.visible.count).to eq(1)
@ -322,5 +326,22 @@ describe Notification do
expect(notifications.map { |n| n.id }).to eq([a.id, d.id, c.id])
end
describe 'for a user that does not want to be notify on liked' do
before do
user.user_option.update!(
like_notification_frequency:
UserOption.like_notification_frequency_type[:never]
)
end
it "should not return any form of liked notifications" do
notification = pm
regular
liked_consolidated
expect(Notification.recent_report(user)).to contain_exactly(notification)
end
end
end
end