2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 10:50:21 +08:00

Allow reading notifications without marking them as read.

This commit is contained in:
Vikhyat Korrapati 2014-06-07 15:47:45 +05:30
parent 92d2912ff2
commit 9b89b1466f
2 changed files with 16 additions and 4 deletions

View file

@ -5,12 +5,24 @@ describe NotificationsController do
context 'when logged in' do
let!(:user) { log_in }
before do
it 'should succeed' do
xhr :get, :index
response.should be_success
end
subject { response }
it { should be_success }
it 'should mark notifications as viewed' do
notification = Fabricate(:notification, user: user)
user.reload.unread_notifications.should == 1
xhr :get, :index
user.reload.unread_notifications.should == 0
end
it 'should not mark notifications as viewed if silent param is present' do
notification = Fabricate(:notification, user: user)
user.reload.unread_notifications.should == 1
xhr :get, :index, silent: true
user.reload.unread_notifications.should == 1
end
end
context 'when not logged in' do