mirror of
https://github.com/kaminari/kaminari.git
synced 2022-11-09 13:44:37 -05:00
Fixes the inconsistency in the #first_page method
This commit is contained in:
parent
c7d19fa403
commit
9d46d6029c
2 changed files with 7 additions and 1 deletions
|
@ -75,7 +75,7 @@ module Kaminari
|
|||
|
||||
# First page of the collection?
|
||||
def first_page?
|
||||
current_page == 1
|
||||
!out_of_range? && (current_page == 1)
|
||||
end
|
||||
|
||||
# Last page of the collection?
|
||||
|
|
|
@ -340,6 +340,12 @@ if defined? ActiveRecord
|
|||
test 'not on first page' do
|
||||
assert_false model_class.page(5).per(10).first_page?
|
||||
end
|
||||
|
||||
test 'on first page with no record' do
|
||||
model_class.delete_all
|
||||
|
||||
assert_false model_class.page(1).first_page?
|
||||
end
|
||||
end
|
||||
|
||||
sub_test_case '#last_page?' do
|
||||
|
|
Loading…
Reference in a new issue