Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActiveRecord Relation size mismatch on last page when not loaded #498

Open
hallelujah opened this issue Aug 4, 2016 · 0 comments
Open

Comments

@hallelujah
Copy link

This can be added to spec/finders/active_record_spec.rb

  it 'returns correct `size` for last page' do
    users = User.paginate(:page => 3, :per_page => 5)
    users.total_entries.should == 13
    users.total_pages.should == 3

    users.size.should == 3
  end

The test is failing:

bundle exec rspec spec/finders/active_record_spec.rb:420                                                                                    [2.3]
using sqlite3 adapter
Run filtered including {:line_number=>420}
F

Failures:

  1) WillPaginate::ActiveRecord returns correct `size` for last page
     Failure/Error: users.size.should == 3
       expected: 3
            got: 5 (using ==)
     # ./spec/finders/active_record_spec.rb:425:in `block (2 levels) in <top (required)>'

Finished in 0.00122 seconds
1 example, 1 failure

Failed examples:

rspec ./spec/finders/active_record_spec.rb:420 # WillPaginate::ActiveRecord returns correct `size` for last page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant