speed up notifications controller index spec

This commit is contained in:
Dan Hansen 2011-06-28 23:31:34 -07:00
parent b8ea8e9e75
commit eaf7fcd7fe

View file

@ -47,15 +47,18 @@ describe NotificationsController do
describe '#index' do describe '#index' do
before do before do
@post = Factory(:status_message) @post = Factory(:status_message)
26.times do Factory(:notification, :recipient => @user, :target => @post)
Factory(:notification, :recipient => @user, :target => @post)
end
end end
it 'paginates the notifications' do it 'paginates the notifications' do
25.times do
Factory(:notification, :recipient => @user, :target => @post)
end
@controller.index({})[:notifications].count.should == 25 @controller.index({})[:notifications].count.should == 25
@controller.index(:page => 2)[:notifications].count.should == 1 @controller.index(:page => 2)[:notifications].count.should == 1
end end
it "includes the actors" do it "includes the actors" do
notification = Factory(:notification, :recipient => @user, :target => @post) notification = Factory(:notification, :recipient => @user, :target => @post)
response = @controller.index({}) response = @controller.index({})