test/collection_test.rb in will_paginate-2.3.15 vs test/collection_test.rb in will_paginate-2.3.16
- old
+ new
@@ -117,16 +117,33 @@
bad_inputs.each do |bad|
assert_raise(WillPaginate::InvalidPage) { create bad }
end
end
- def test_invalid_per_page_setting
- assert_raise(ArgumentError) { create(1, -1) }
+ def test_invalid_offset
+ error = assert_raise(WillPaginate::InvalidPage) { create(307445734561825862, 30) }
+ assert_equal "invalid offset: 9223372036854775830", error.message
end
def test_page_count_was_removed
assert_raise(NoMethodError) { create.page_count }
# It's `total_pages` now.
+ end
+
+ def test_inherits_global_per_page
+ col = WillPaginate::Collection.new(1)
+ assert_equal 30, col.per_page
+
+ WillPaginate.per_page = 12
+ begin
+ col = WillPaginate::Collection.new(1)
+ assert_equal 12, col.per_page
+
+ col = ('a'..'z').to_a.paginate(:page => 1)
+ assert_equal 12, col.per_page
+ ensure
+ WillPaginate.per_page = 30
+ end
end
private
def create(page = 2, limit = 5, total = nil, &block)
if block_given?