Commit e6e45763b8de063ced7fb08118f3440e2e2d6453
1 parent
6191e44e
Exists in
master
and in
1 other branch
User pagination spec fix.
Showing
1 changed file
with
5 additions
and
4 deletions
Show diff stats
spec/controllers/users_controller_spec.rb
| @@ -77,15 +77,16 @@ describe UsersController do | @@ -77,15 +77,16 @@ describe UsersController do | ||
| 77 | 77 | ||
| 78 | context 'Signed in as an admin' do | 78 | context 'Signed in as an admin' do |
| 79 | before do | 79 | before do |
| 80 | - sign_in Factory(:admin) | 80 | + @user = Factory(:admin) |
| 81 | + sign_in @user | ||
| 81 | end | 82 | end |
| 82 | 83 | ||
| 83 | context "GET /users" do | 84 | context "GET /users" do |
| 84 | it 'paginates all users' do | 85 | it 'paginates all users' do |
| 85 | - users = 3.times.inject(WillPaginate::Collection.new(1,30)) {|page,_| page << Factory.build(:user)} | ||
| 86 | - User.should_receive(:paginate).and_return(users) | 86 | + @user.update_attribute :per_page, 2 |
| 87 | + users = 3.times { Factory(:user) } | ||
| 87 | get :index | 88 | get :index |
| 88 | - assigns(:users).should == users | 89 | + assigns(:users).size.should == 2 |
| 89 | end | 90 | end |
| 90 | end | 91 | end |
| 91 | 92 |