Wrote spec test for notifications pagination
This commit is contained in:
parent
e0f583d7d3
commit
46e9be88d1
1 changed files with 14 additions and 0 deletions
|
|
@ -32,4 +32,18 @@ describe NotificationsController do
|
||||||
Notification.find(note.id).unread.should == true
|
Notification.find(note.id).unread.should == true
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue