mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 10:57:22 +08:00
Mark badge notification as read when the notification is clicked.
This commit is contained in:
@ -2,6 +2,11 @@ require 'spec_helper'
|
||||
|
||||
describe BadgesController do
|
||||
let!(:badge) { Fabricate(:badge) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
||||
before do
|
||||
SiteSetting.enable_badges = true
|
||||
end
|
||||
|
||||
context 'index' do
|
||||
it 'should return a list of all badges' do
|
||||
@ -20,5 +25,13 @@ describe BadgesController do
|
||||
parsed = JSON.parse(response.body)
|
||||
parsed["badge"].should be_present
|
||||
end
|
||||
|
||||
it "should mark the notification as viewed" do
|
||||
log_in_user(user)
|
||||
user_badge = BadgeGranter.grant(badge, user)
|
||||
user_badge.notification.read.should == false
|
||||
get :show, id: badge.id, format: :json
|
||||
user_badge.notification.reload.read.should == true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user