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

FEATURE: clean API method for reading a single notification

This commit is contained in:
Sam 2016-09-16 16:14:00 +10:00
parent 0290619669
commit 75f3f7fcbd
5 changed files with 34 additions and 9 deletions

View file

@ -38,6 +38,19 @@ describe NotificationsController do
expect(user.reload.total_unread_notifications).to eq(1)
end
it "can update a single notification" do
notification = Fabricate(:notification, user: user)
notification2 = Fabricate(:notification, user: user)
xhr :put, :mark_read, id: notification.id
expect(response).to be_success
notification.reload
notification2.reload
expect(notification.read).to eq(true)
expect(notification2.read).to eq(false)
end
it "updates the `read` status" do
notification = Fabricate(:notification, user: user)
expect(user.reload.unread_notifications).to eq(1)