From 46e9be88d1661793846b20e74030c1cfccc40de2 Mon Sep 17 00:00:00 2001 From: Nick van der Burgt Date: Wed, 29 Dec 2010 12:27:39 +0100 Subject: [PATCH] Wrote spec test for notifications pagination --- spec/controllers/notifications_controller_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/controllers/notifications_controller_spec.rb b/spec/controllers/notifications_controller_spec.rb index 7a41f887f..78e6955e4 100644 --- a/spec/controllers/notifications_controller_spec.rb +++ b/spec/controllers/notifications_controller_spec.rb @@ -32,4 +32,18 @@ describe NotificationsController do Notification.find(note.id).unread.should == true end end + + describe '#index' do + it 'paginates the notifications' do + 35.times do + Notification.create(:user_id => user.id) + end + + get :index + assigns[:notifications].should == Notification.all(:user_id => user.id, :limit => 25) + + get :index, :page => 2 + assigns[:notifications].should == Notification.all(:user_id => user.id, :offset => 25) + end + end end