Newer
Older
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
require 'spec_helper'
describe NotificationsController do
let!(:user) { Factory.create(:user) }
note = Notification.create(:recipient_id => user.id)
put :update, :id => note.id
Notification.first.unread.should == false
user2 = Factory.create(:user)
Notification.create(:recipient_id => user.id)
note = Notification.create(:recipient_id => user2.id)
Notification.find(note.id).unread.should == true
describe "#read_all" do
it 'marks all notifications as read' do
Notification.create(:recipient_id => user.id)
Notification.create(:recipient_id => user.id)
Notification.where(:unread => true).count.should == 2
get :read_all
Notification.where(:unread => true).count.should == 0
end
end