"
end
it 'renders last page' do
pagy = Pagy.new(count: 103, page: 6)
- view.pagy_materialize_combo_nav_js(pagy, pagy_test_id).must_equal \
+ _(view.pagy_materialize_combo_nav_js(pagy, pagy_test_id)).must_equal \
"
"
end
diff --git a/test/pagy/extras/metadata_test.rb b/test/pagy/extras/metadata_test.rb
index b3b7050f5..377121e3b 100644
--- a/test/pagy/extras/metadata_test.rb
+++ b/test/pagy/extras/metadata_test.rb
@@ -16,24 +16,24 @@
end
it 'defines all metadata' do
- Pagy::VARS[:metadata].must_equal [:scaffold_url, :first_url, :prev_url, :page_url, :next_url, :last_url, :count, :page, :items, :vars, :pages, :last, :from, :to, :prev, :next, :series, :sequels]
+ _(Pagy::VARS[:metadata]).must_equal [:scaffold_url, :first_url, :prev_url, :page_url, :next_url, :last_url, :count, :page, :items, :vars, :pages, :last, :from, :to, :prev, :next, :series, :sequels]
end
it 'returns the full pagy metadata' do
pagy, _records = @controller.send(:pagy, @collection)
- @controller.send(:pagy_metadata, pagy).must_equal(
+ _(@controller.send(:pagy_metadata, pagy)).must_equal(
{:scaffold_url=>"/foo?page=__pagy_page__", :first_url=>"/foo?page=1", :prev_url=>"/foo?page=2", :page_url=>"/foo?page=3", :next_url=>"/foo?page=4", :last_url=>"/foo?page=50", :count=>1000, :page=>3, :items=>20, :vars=>{:page=>3, :items=>20, :outset=>0, :size=>[1, 4, 4, 1], :page_param=>:page, :params=>{}, :anchor=>"", :link_extra=>"", :i18n_key=>"pagy.item_name", :cycle=>false, :steps=>false, :metadata=>[:scaffold_url, :first_url, :prev_url, :page_url, :next_url, :last_url, :count, :page, :items, :vars, :pages, :last, :from, :to, :prev, :next, :series, :sequels], :count=>1000}, :pages=>50, :last=>50, :from=>41, :to=>60, :prev=>2, :next=>4, :series=>[1, 2, "3", 4, 5, 6, 7, :gap, 50], :sequels=>{"0"=>[1, 2, "3", 4, 5, 6, 7, :gap, 50]}}
)
end
it 'checks for unknown metadata' do
pagy, _records = @controller.send(:pagy, @collection, metadata: [:page, :unknown_key])
- proc { @controller.send(:pagy_metadata, pagy)}.must_raise Pagy::VariableError
+ _(proc { @controller.send(:pagy_metadata, pagy)}).must_raise Pagy::VariableError
end
it 'returns only specific metadata' do
pagy, _records = @controller.send(:pagy, @collection, metadata: [:scaffold_url, :page, :count, :prev, :next, :pages])
- @controller.send(:pagy_metadata, pagy).must_equal(
+ _(@controller.send(:pagy_metadata, pagy)).must_equal(
{:scaffold_url=>"/foo?page=__pagy_page__", :page=>3, :count=>1000, :prev=>2, :next=>4, :pages=>50}
)
end
diff --git a/test/pagy/extras/navs_test.rb b/test/pagy/extras/navs_test.rb
index b2f4f9173..9ae94a97b 100644
--- a/test/pagy/extras/navs_test.rb
+++ b/test/pagy/extras/navs_test.rb
@@ -13,25 +13,25 @@
it 'renders first page' do
pagy = Pagy.new(count: 1000, page: 1)
- view.pagy_nav_js(pagy, pagy_test_id).must_equal \
+ _(view.pagy_nav_js(pagy, pagy_test_id)).must_equal \
"
"
end
it 'renders intermediate page' do
pagy = Pagy.new(count: 1000, page: 20)
- view.pagy_nav_js(pagy, pagy_test_id).must_equal \
+ _(view.pagy_nav_js(pagy, pagy_test_id)).must_equal \
"
"
end
it 'renders last page' do
pagy = Pagy.new(count: 1000, page: 50)
- view.pagy_nav_js(pagy, pagy_test_id).must_equal \
+ _(view.pagy_nav_js(pagy, pagy_test_id)).must_equal \
"
"
end
it 'renders with :steps' do
pagy = Pagy.new(count: 1000, page: 20, steps: {0 => [1,2,2,1], 500 => [2,3,3,2]})
- view.pagy_nav_js(pagy, pagy_test_id).must_equal \
+ _(view.pagy_nav_js(pagy, pagy_test_id)).must_equal \
"
"
end
@@ -41,19 +41,19 @@
it 'renders first page' do
pagy = Pagy.new(count: 103, page: 1)
- view.pagy_combo_nav_js(pagy, pagy_test_id).must_equal \
+ _(view.pagy_combo_nav_js(pagy, pagy_test_id)).must_equal \
"
‹ Prev Page of 6 Next › "
end
it 'renders intermediate page' do
pagy = Pagy.new(count: 103, page: 3)
- view.pagy_combo_nav_js(pagy, pagy_test_id).must_equal \
+ _(view.pagy_combo_nav_js(pagy, pagy_test_id)).must_equal \
"
‹ Prev Page of 6 Next › "
end
it 'renders last page' do
pagy = Pagy.new(count: 103, page: 6)
- view.pagy_combo_nav_js(pagy, pagy_test_id).must_equal \
+ _(view.pagy_combo_nav_js(pagy, pagy_test_id)).must_equal \
"
‹ Prev Page of 6 Next › "
end
diff --git a/test/pagy/extras/overflow_test.rb b/test/pagy/extras/overflow_test.rb
index b6d5a0490..34d7c039e 100644
--- a/test/pagy/extras/overflow_test.rb
+++ b/test/pagy/extras/overflow_test.rb
@@ -20,7 +20,7 @@
describe "variables" do
it 'has vars defaults' do
- Pagy::VARS[:overflow].must_equal :empty_page # default for countless
+ _(Pagy::VARS[:overflow]).must_equal :empty_page # default for countless
end
end
@@ -28,9 +28,9 @@
describe "#overflow?" do
it 'must be overflow?' do
- @pagy.must_be :overflow?
- @pagy_countless.must_be :overflow?
- Pagy.new(vars.merge(page:2)).wont_be :overflow?
+ _(@pagy).must_be :overflow?
+ _(@pagy_countless).must_be :overflow?
+ _(Pagy.new(vars.merge(page:2))).wont_be :overflow?
end
end
@@ -40,34 +40,34 @@
it 'works in :last_page mode' do
pagy = Pagy.new(vars.merge(overflow: :last_page))
- pagy.must_be_instance_of Pagy
- pagy.page.must_equal pagy.last
- pagy.vars[:page].must_equal 100
- pagy.offset.must_equal 100
- pagy.items.must_equal 3
- pagy.from.must_equal 101
- pagy.to.must_equal 103
- pagy.prev.must_equal 10
+ _(pagy).must_be_instance_of Pagy
+ _(pagy.page).must_equal pagy.last
+ _(pagy.vars[:page]).must_equal 100
+ _(pagy.offset).must_equal 100
+ _(pagy.items).must_equal 3
+ _(pagy.from).must_equal 101
+ _(pagy.to).must_equal 103
+ _(pagy.prev).must_equal 10
end
it 'raises OverflowError in :exception mode' do
- proc { Pagy.new(vars.merge(overflow: :exception)) }.must_raise Pagy::OverflowError
- proc { Pagy::Countless.new(countless_vars.merge(overflow: :exception)).finalize(0) }.must_raise Pagy::OverflowError
+ _(proc { Pagy.new(vars.merge(overflow: :exception)) }).must_raise Pagy::OverflowError
+ _(proc { Pagy::Countless.new(countless_vars.merge(overflow: :exception)).finalize(0) }).must_raise Pagy::OverflowError
end
it 'works in :empty_page mode' do
pagy = Pagy.new(vars.merge(overflow: :empty_page))
- pagy.page.must_equal 100
- pagy.offset.must_equal 0
- pagy.items.must_equal 0
- pagy.from.must_equal 0
- pagy.to.must_equal 0
- pagy.prev.must_equal pagy.last
+ _(pagy.page).must_equal 100
+ _(pagy.offset).must_equal 0
+ _(pagy.items).must_equal 0
+ _(pagy.from).must_equal 0
+ _(pagy.to).must_equal 0
+ _(pagy.prev).must_equal pagy.last
end
it 'raises Pagy::VariableError' do
- proc { Pagy.new(vars.merge(overflow: :unknown)) }.must_raise Pagy::VariableError
- proc { Pagy::Countless.new(countless_vars.merge(overflow: :unknown)).finalize(0) }.must_raise Pagy::VariableError
+ _(proc { Pagy.new(vars.merge(overflow: :unknown)) }).must_raise Pagy::VariableError
+ _(proc { Pagy::Countless.new(countless_vars.merge(overflow: :unknown)).finalize(0) }).must_raise Pagy::VariableError
end
end
@@ -77,14 +77,14 @@
it 'computes series for last page' do
pagy = Pagy.new(vars.merge(overflow: :empty_page))
series = pagy.series
- series.must_equal [1, 2, 3, :gap, 9, 10, 11]
- pagy.page.must_equal 100
+ _(series).must_equal [1, 2, 3, :gap, 9, 10, 11]
+ _(pagy.page).must_equal 100
end
it 'computes empty series' do
series = @pagy_countless.series
- series.must_equal []
- @pagy_countless.page.must_equal 100
+ _(series).must_equal []
+ _(@pagy_countless.page).must_equal 100
end
end
diff --git a/test/pagy/extras/searchkick_test.rb b/test/pagy/extras/searchkick_test.rb
index d2142ceed..dc2ac556b 100644
--- a/test/pagy/extras/searchkick_test.rb
+++ b/test/pagy/extras/searchkick_test.rb
@@ -12,33 +12,33 @@
describe '#pagy_search' do
it 'extends the class with #pagy_search' do
- MockSearchkick::Model.must_respond_to :pagy_search
+ _(MockSearchkick::Model).must_respond_to :pagy_search
end
it 'returns class and arguments' do
- MockSearchkick::Model.pagy_search('a', b:2).must_equal [MockSearchkick::Model, ['a', {b: 2}], nil]
+ _(MockSearchkick::Model.pagy_search('a', b:2)).must_equal [MockSearchkick::Model, ['a', {b: 2}], nil]
args = MockSearchkick::Model.pagy_search('a', b:2){|a| a*2}
block = args[-1]
- args.must_equal [MockSearchkick::Model, ['a', {b: 2}], block]
+ _(args).must_equal [MockSearchkick::Model, ['a', {b: 2}], block]
end
it 'allows the term argument to be optional' do
- MockSearchkick::Model.pagy_search(b:2).must_equal [MockSearchkick::Model, [{b: 2}], nil]
+ _(MockSearchkick::Model.pagy_search(b:2)).must_equal [MockSearchkick::Model, [{b: 2}], nil]
args = MockSearchkick::Model.pagy_search(b:2){|a| a*2}
block = args[-1]
- args.must_equal [MockSearchkick::Model, [{b: 2}], block]
+ _(args).must_equal [MockSearchkick::Model, [{b: 2}], block]
end
it 'adds an empty option hash' do
- MockSearchkick::Model.pagy_search('a').must_equal [MockSearchkick::Model, ['a', {}], nil]
+ _(MockSearchkick::Model.pagy_search('a')).must_equal [MockSearchkick::Model, ['a', {}], nil]
args = MockSearchkick::Model.pagy_search('a'){|a| a*2}
block = args[-1]
- args.must_equal [MockSearchkick::Model, ['a', {}], block]
+ _(args).must_equal [MockSearchkick::Model, ['a', {}], block]
end
it 'adds the caller and arguments' do
- MockSearchkick::Model.pagy_search('a', b:2).results.must_equal [MockSearchkick::Model, ['a', {b: 2}], nil, :results]
- MockSearchkick::Model.pagy_search('a', b:2).a('b', 2).must_equal [MockSearchkick::Model, ['a', {b: 2}], nil, :a, 'b', 2]
+ _(MockSearchkick::Model.pagy_search('a', b:2).results).must_equal [MockSearchkick::Model, ['a', {b: 2}], nil, :results]
+ _(MockSearchkick::Model.pagy_search('a', b:2).a('b', 2)).must_equal [MockSearchkick::Model, ['a', {b: 2}], nil, :a, 'b', 2]
end
end
@@ -58,44 +58,44 @@
it 'paginates response with defaults' do
pagy, response = controller.send(:pagy_searchkick, MockSearchkick::Model.pagy_search('a'){'B-'})
results = response.results
- pagy.must_be_instance_of Pagy
- pagy.count.must_equal 1000
- pagy.items.must_equal Pagy::VARS[:items]
- pagy.page.must_equal controller.params[:page]
- results.count.must_equal Pagy::VARS[:items]
- results.must_equal ["R-B-a-41", "R-B-a-42", "R-B-a-43", "R-B-a-44", "R-B-a-45", "R-B-a-46", "R-B-a-47", "R-B-a-48", "R-B-a-49", "R-B-a-50", "R-B-a-51", "R-B-a-52", "R-B-a-53", "R-B-a-54", "R-B-a-55", "R-B-a-56", "R-B-a-57", "R-B-a-58", "R-B-a-59", "R-B-a-60"]
+ _(pagy).must_be_instance_of Pagy
+ _(pagy.count).must_equal 1000
+ _(pagy.items).must_equal Pagy::VARS[:items]
+ _(pagy.page).must_equal controller.params[:page]
+ _(results.count).must_equal Pagy::VARS[:items]
+ _(results).must_equal ["R-B-a-41", "R-B-a-42", "R-B-a-43", "R-B-a-44", "R-B-a-45", "R-B-a-46", "R-B-a-47", "R-B-a-48", "R-B-a-49", "R-B-a-50", "R-B-a-51", "R-B-a-52", "R-B-a-53", "R-B-a-54", "R-B-a-55", "R-B-a-56", "R-B-a-57", "R-B-a-58", "R-B-a-59", "R-B-a-60"]
end
it 'paginates results with defaults' do
pagy, results = controller.send(:pagy_searchkick, MockSearchkick::Model.pagy_search('a').results)
- pagy.must_be_instance_of Pagy
- pagy.count.must_equal 1000
- pagy.items.must_equal Pagy::VARS[:items]
- pagy.page.must_equal controller.params[:page]
- results.count.must_equal Pagy::VARS[:items]
- results.must_equal ["R-a-41", "R-a-42", "R-a-43", "R-a-44", "R-a-45", "R-a-46", "R-a-47", "R-a-48", "R-a-49", "R-a-50", "R-a-51", "R-a-52", "R-a-53", "R-a-54", "R-a-55", "R-a-56", "R-a-57", "R-a-58", "R-a-59", "R-a-60"]
+ _(pagy).must_be_instance_of Pagy
+ _(pagy.count).must_equal 1000
+ _(pagy.items).must_equal Pagy::VARS[:items]
+ _(pagy.page).must_equal controller.params[:page]
+ _(results.count).must_equal Pagy::VARS[:items]
+ _(results).must_equal ["R-a-41", "R-a-42", "R-a-43", "R-a-44", "R-a-45", "R-a-46", "R-a-47", "R-a-48", "R-a-49", "R-a-50", "R-a-51", "R-a-52", "R-a-53", "R-a-54", "R-a-55", "R-a-56", "R-a-57", "R-a-58", "R-a-59", "R-a-60"]
end
it 'paginates with vars' do
pagy, results = controller.send(:pagy_searchkick, MockSearchkick::Model.pagy_search('b').results, page: 2, items: 10, link_extra: 'X')
- pagy.must_be_instance_of Pagy
- pagy.count.must_equal 1000
- pagy.items.must_equal 10
- pagy.page.must_equal 2
- pagy.vars[:link_extra].must_equal 'X'
- results.count.must_equal 10
- results.must_equal ["R-b-11", "R-b-12", "R-b-13", "R-b-14", "R-b-15", "R-b-16", "R-b-17", "R-b-18", "R-b-19", "R-b-20"]
+ _(pagy).must_be_instance_of Pagy
+ _(pagy.count).must_equal 1000
+ _(pagy.items).must_equal 10
+ _(pagy.page).must_equal 2
+ _(pagy.vars[:link_extra]).must_equal 'X'
+ _(results.count).must_equal 10
+ _(results).must_equal ["R-b-11", "R-b-12", "R-b-13", "R-b-14", "R-b-15", "R-b-16", "R-b-17", "R-b-18", "R-b-19", "R-b-20"]
end
it 'paginates with overflow' do
pagy, results = controller.send(:pagy_searchkick, MockSearchkick::Model.pagy_search('b').results, page: 200, items: 10, link_extra: 'X', overflow: :last_page)
- pagy.must_be_instance_of Pagy
- pagy.count.must_equal 1000
- pagy.items.must_equal 10
- pagy.page.must_equal 100
- pagy.vars[:link_extra].must_equal 'X'
- results.count.must_equal 10
- results.must_equal ["R-b-991", "R-b-992", "R-b-993", "R-b-994", "R-b-995", "R-b-996", "R-b-997", "R-b-998", "R-b-999", "R-b-1000"]
+ _(pagy).must_be_instance_of Pagy
+ _(pagy.count).must_equal 1000
+ _(pagy.items).must_equal 10
+ _(pagy.page).must_equal 100
+ _(pagy.vars[:link_extra]).must_equal 'X'
+ _(results.count).must_equal 10
+ _(results).must_equal ["R-b-991", "R-b-992", "R-b-993", "R-b-994", "R-b-995", "R-b-996", "R-b-997", "R-b-998", "R-b-999", "R-b-1000"]
end
end
@@ -105,21 +105,21 @@
it 'gets defaults' do
vars = {}
merged = controller.send :pagy_searchkick_get_vars, nil, vars
- merged.keys.must_include :page
- merged.keys.must_include :items
- merged[:page].must_equal 3
- merged[:items].must_equal 20
+ _(merged.keys).must_include :page
+ _(merged.keys).must_include :items
+ _(merged[:page]).must_equal 3
+ _(merged[:items]).must_equal 20
end
it 'gets vars' do
vars = {page: 2, items: 10, link_extra: 'X'}
merged = controller.send :pagy_searchkick_get_vars, nil, vars
- merged.keys.must_include :page
- merged.keys.must_include :items
- merged.keys.must_include :link_extra
- merged[:page].must_equal 2
- merged[:items].must_equal 10
- merged[:link_extra].must_equal 'X'
+ _(merged.keys).must_include :page
+ _(merged.keys).must_include :items
+ _(merged.keys).must_include :link_extra
+ _(merged[:page]).must_equal 2
+ _(merged[:items]).must_equal 10
+ _(merged[:link_extra]).must_equal 'X'
end
end
@@ -129,20 +129,20 @@
it 'paginates results with defaults' do
results = MockSearchkick::Model.search('a')
pagy = Pagy.new_from_searchkick(results)
- pagy.must_be_instance_of Pagy
- pagy.count.must_equal 1000
- pagy.items.must_equal 1000
- pagy.page.must_equal 1
+ _(pagy).must_be_instance_of Pagy
+ _(pagy.count).must_equal 1000
+ _(pagy.items).must_equal 1000
+ _(pagy.page).must_equal 1
end
it 'paginates results with vars' do
results = MockSearchkick::Model.search('b', page: 2, per_page: 15)
pagy = Pagy.new_from_searchkick(results, link_extra: 'X')
- pagy.must_be_instance_of Pagy
- pagy.count.must_equal 1000
- pagy.items.must_equal 15
- pagy.page.must_equal 2
- pagy.vars[:link_extra].must_equal 'X'
+ _(pagy).must_be_instance_of Pagy
+ _(pagy.count).must_equal 1000
+ _(pagy.items).must_equal 15
+ _(pagy.page).must_equal 2
+ _(pagy.vars[:link_extra]).must_equal 'X'
end
end
diff --git a/test/pagy/extras/semantic_test.rb b/test/pagy/extras/semantic_test.rb
index 7920c3ca8..2f448117b 100644
--- a/test/pagy/extras/semantic_test.rb
+++ b/test/pagy/extras/semantic_test.rb
@@ -13,19 +13,19 @@
it 'renders first page' do
pagy = Pagy.new(count: 1000, page: 1)
- view.pagy_semantic_nav(pagy).must_equal \
+ _(view.pagy_semantic_nav(pagy)).must_equal \
"
"
end
it 'renders intermediate page' do
pagy = Pagy.new(count: 1000, page: 20)
- view.pagy_semantic_nav(pagy).must_equal \
+ _(view.pagy_semantic_nav(pagy)).must_equal \
"
"
end
it 'renders last page' do
pagy = Pagy.new(count: 1000, page: 50)
- view.pagy_semantic_nav(pagy).must_equal \
+ _(view.pagy_semantic_nav(pagy)).must_equal \
"
"
end
@@ -35,25 +35,25 @@
it 'renders first page' do
pagy = Pagy.new(count: 1000, page: 1)
- view.pagy_semantic_nav_js(pagy, pagy_test_id).must_equal \
+ _(view.pagy_semantic_nav_js(pagy, pagy_test_id)).must_equal \
"
"
end
it 'renders intermediate page' do
pagy = Pagy.new(count: 1000, page: 20)
- view.pagy_semantic_nav_js(pagy, pagy_test_id).must_equal \
+ _(view.pagy_semantic_nav_js(pagy, pagy_test_id)).must_equal \
"
"
end
it 'renders last page' do
pagy = Pagy.new(count: 1000, page: 50)
- view.pagy_semantic_nav_js(pagy, pagy_test_id).must_equal \
+ _(view.pagy_semantic_nav_js(pagy, pagy_test_id)).must_equal \
"
"
end
it 'renders with :steps' do
pagy = Pagy.new(count: 1000, page: 20, steps: {0 => [1,2,2,1], 500 => [2,3,3,2]})
- view.pagy_semantic_nav_js(pagy, pagy_test_id).must_equal \
+ _(view.pagy_semantic_nav_js(pagy, pagy_test_id)).must_equal \
"
"
end
@@ -63,19 +63,19 @@
it 'renders first page' do
pagy = Pagy.new(count: 103, page: 1)
- view.pagy_semantic_combo_nav_js(pagy, pagy_test_id).must_equal \
+ _(view.pagy_semantic_combo_nav_js(pagy, pagy_test_id)).must_equal \
"
"
end
it 'renders intermediate page' do
pagy = Pagy.new(count: 103, page: 3)
- view.pagy_semantic_combo_nav_js(pagy, pagy_test_id).must_equal \
+ _(view.pagy_semantic_combo_nav_js(pagy, pagy_test_id)).must_equal \
"
"
end
it 'renders last page' do
pagy = Pagy.new(count: 103, page: 6)
- view.pagy_semantic_combo_nav_js(pagy, pagy_test_id).must_equal \
+ _(view.pagy_semantic_combo_nav_js(pagy, pagy_test_id)).must_equal \
"
"
end
diff --git a/test/pagy/extras/shared_combo_test.rb b/test/pagy/extras/shared_combo_test.rb
index 065b2e824..a8c067fc6 100644
--- a/test/pagy/extras/shared_combo_test.rb
+++ b/test/pagy/extras/shared_combo_test.rb
@@ -16,33 +16,16 @@
it 'should return the marked link' do
pagy = Pagy.new(count: 100, page: 4)
- view.instance_eval do
- pagy_marked_link(pagy_link_proc(pagy)).must_equal(
- "
"
- )
- end
+ _(view.pagy_marked_link(view.pagy_link_proc(pagy))).must_equal "
"
pagy = Pagy.new(count: 100, page: 4, page_param: 'p')
- view.instance_eval do
- pagy_marked_link(pagy_link_proc(pagy)).must_equal(
- "
"
- )
- end
+ _(view.pagy_marked_link(view.pagy_link_proc(pagy))).must_equal "
"
pagy = Pagy.new(count: 100, page: 4, items_param: 'i')
- view.instance_eval do
- pagy_marked_link(pagy_link_proc(pagy)).must_equal(
- "
"
- )
- end
+ _(view.pagy_marked_link(view.pagy_link_proc(pagy))).must_equal "
"
pagy = Pagy.new(count: 100, page: 4, page_param: 'p', items_param: 'i')
- view.instance_eval do
- pagy_marked_link(pagy_link_proc(pagy)).must_equal(
- "
"
- )
- end
-
+ _(view.pagy_marked_link(view.pagy_link_proc(pagy))).must_equal "
"
end
@@ -52,8 +35,7 @@
it 'renders items selector with trim' do
pagy = Pagy.new count: 1000, page: 3
- view.pagy_items_selector_js(pagy, 'test-id').must_equal \
- "
Show items per page "
+ _(view.pagy_items_selector_js(pagy, 'test-id')).must_equal "
Show items per page "
end
end
diff --git a/test/pagy/extras/shared_test.rb b/test/pagy/extras/shared_test.rb
index b9a68e4b2..c16292d89 100644
--- a/test/pagy/extras/shared_test.rb
+++ b/test/pagy/extras/shared_test.rb
@@ -17,7 +17,7 @@
describe "#pagy_json_tag" do
it 'should use oj' do
- view.pagy_json_tag(:test_function, 'some-id', 'some-string', 123, true).must_equal \
+ _(view.pagy_json_tag(:test_function, 'some-id', 'some-string', 123, true)).must_equal \
""
end
@@ -29,9 +29,9 @@
it 'should return different SHA1 ids' do
id1 = call_pagy_id
id2 = call_pagy_id
- id1.must_be_kind_of String
- id2.must_be_kind_of String
- id1.must_be :!=, id2
+ _(id1).must_be_kind_of String
+ _(id2).must_be_kind_of String
+ _(id1).must_be :!=, id2
end
end
@@ -40,13 +40,9 @@
it 'should return only the "standard" link' do
pagy = Pagy.new(count: 100, page: 4)
- view.instance_eval do
- pagy_marked_link(pagy_link_proc(pagy)).must_equal("
")
- end
+ _(view.pagy_marked_link(view.pagy_link_proc(pagy))).must_equal("
")
pagy = Pagy.new(count: 100, page: 4, page_param: 'p')
- view.instance_eval do
- pagy_marked_link(pagy_link_proc(pagy)).must_equal("
")
- end
+ _(view.pagy_marked_link(view.pagy_link_proc(pagy))).must_equal("
")
end
end
diff --git a/test/pagy/extras/support_test.rb b/test/pagy/extras/support_test.rb
index ba083d40e..ae056d10f 100644
--- a/test/pagy/extras/support_test.rb
+++ b/test/pagy/extras/support_test.rb
@@ -16,29 +16,29 @@
it 'returns the prev url for page 1' do
pagy = Pagy.new count: 1000, page: 1
pagy_countless = Pagy::Countless.new(page: 1).finalize(21)
- view.pagy_prev_url(pagy).must_be_nil
- view.pagy_prev_url(pagy_countless).must_be_nil
+ _(view.pagy_prev_url(pagy)).must_be_nil
+ _(view.pagy_prev_url(pagy_countless)).must_be_nil
end
it 'returns the prev url for page 3' do
pagy = Pagy.new count: 1000, page: 3
pagy_countless = Pagy::Countless.new(page: 3).finalize(21)
- view.pagy_prev_url(pagy).must_equal '/foo?page=2'
- view.pagy_prev_url(pagy_countless).must_equal '/foo?page=2'
+ _(view.pagy_prev_url(pagy)).must_equal '/foo?page=2'
+ _(view.pagy_prev_url(pagy_countless)).must_equal '/foo?page=2'
end
it 'returns the prev url for page 6' do
pagy = Pagy.new count: 1000, page: 6
pagy_countless = Pagy::Countless.new(page: 6).finalize(21)
- view.pagy_prev_url(pagy).must_equal '/foo?page=5'
- view.pagy_prev_url(pagy_countless).must_equal '/foo?page=5'
+ _(view.pagy_prev_url(pagy)).must_equal '/foo?page=5'
+ _(view.pagy_prev_url(pagy_countless)).must_equal '/foo?page=5'
end
it 'returns the prev url for last page' do
pagy = Pagy.new count: 1000, page: 50
pagy_countless = Pagy::Countless.new(page: 50).finalize(20)
- view.pagy_prev_url(pagy).must_equal '/foo?page=49'
- view.pagy_prev_url(pagy_countless).must_equal '/foo?page=49'
+ _(view.pagy_prev_url(pagy)).must_equal '/foo?page=49'
+ _(view.pagy_prev_url(pagy_countless)).must_equal '/foo?page=49'
end
end
@@ -48,29 +48,29 @@
it 'returns the next url for page 1' do
pagy = Pagy.new count: 1000, page: 1
pagy_countless = Pagy::Countless.new(page: 1).finalize(21)
- view.pagy_next_url(pagy).must_equal '/foo?page=2'
- view.pagy_next_url(pagy_countless).must_equal '/foo?page=2'
+ _(view.pagy_next_url(pagy)).must_equal '/foo?page=2'
+ _(view.pagy_next_url(pagy_countless)).must_equal '/foo?page=2'
end
it 'returns the next url for page 3' do
pagy = Pagy.new count: 1000, page: 3
pagy_countless = Pagy::Countless.new(page: 3).finalize(21)
- view.pagy_next_url(pagy).must_equal '/foo?page=4'
- view.pagy_next_url(pagy_countless).must_equal '/foo?page=4'
+ _(view.pagy_next_url(pagy)).must_equal '/foo?page=4'
+ _(view.pagy_next_url(pagy_countless)).must_equal '/foo?page=4'
end
it 'returns the url next for page 6' do
pagy = Pagy.new count: 1000, page: 6
pagy_countless = Pagy::Countless.new(page: 6).finalize(21)
- view.pagy_next_url(pagy).must_equal '/foo?page=7'
- view.pagy_next_url(pagy_countless).must_equal '/foo?page=7'
+ _(view.pagy_next_url(pagy)).must_equal '/foo?page=7'
+ _(view.pagy_next_url(pagy_countless)).must_equal '/foo?page=7'
end
it 'returns the url next for last page' do
pagy = Pagy.new count: 1000, page: 50
pagy_countless = Pagy::Countless.new(page: 50).finalize(20)
- view.pagy_next_url(pagy).must_be_nil
- view.pagy_next_url(pagy_countless).must_be_nil
+ _(view.pagy_next_url(pagy)).must_be_nil
+ _(view.pagy_next_url(pagy_countless)).must_be_nil
end
end
@@ -80,29 +80,29 @@
it 'renders the prev link for page 1' do
pagy = Pagy.new count: 1000, page: 1
pagy_countless = Pagy::Countless.new(page: 1).finalize(21)
- view.pagy_prev_link(pagy).must_equal "
‹ Prev "
- view.pagy_prev_link(pagy_countless).must_equal "
‹ Prev "
+ _(view.pagy_prev_link(pagy)).must_equal "
‹ Prev "
+ _(view.pagy_prev_link(pagy_countless)).must_equal "
‹ Prev "
end
it 'renders the prev link for page 3' do
pagy = Pagy.new count: 1000, page: 3
pagy_countless = Pagy::Countless.new(page: 3).finalize(21)
- view.pagy_prev_link(pagy).must_equal "
‹ Prev "
- view.pagy_prev_link(pagy_countless).must_equal "
‹ Prev "
+ _(view.pagy_prev_link(pagy)).must_equal "
‹ Prev "
+ _(view.pagy_prev_link(pagy_countless)).must_equal "
‹ Prev "
end
it 'renders the prev link for page 6' do
pagy = Pagy.new count: 1000, page: 6
pagy_countless = Pagy::Countless.new(page: 6).finalize(21)
- view.pagy_prev_link(pagy).must_equal "
‹ Prev "
- view.pagy_prev_link(pagy_countless).must_equal "
‹ Prev "
+ _(view.pagy_prev_link(pagy)).must_equal "
‹ Prev "
+ _(view.pagy_prev_link(pagy_countless)).must_equal "
‹ Prev "
end
it 'renders the prev link for last page' do
pagy = Pagy.new count: 1000, page: 50
pagy_countless = Pagy::Countless.new(page: 50).finalize(20)
- view.pagy_prev_link(pagy).must_equal "
‹ Prev "
- view.pagy_prev_link(pagy_countless).must_equal "
‹ Prev "
+ _(view.pagy_prev_link(pagy)).must_equal "
‹ Prev "
+ _(view.pagy_prev_link(pagy_countless)).must_equal "
‹ Prev "
end
end
@@ -112,29 +112,29 @@
it 'renders the next link for page 1' do
pagy = Pagy.new count: 1000, page: 1
pagy_countless = Pagy::Countless.new(page: 1).finalize(21)
- view.pagy_next_link(pagy).must_equal "
Next › "
- view.pagy_next_link(pagy_countless).must_equal "
Next › "
+ _(view.pagy_next_link(pagy)).must_equal "
Next › "
+ _(view.pagy_next_link(pagy_countless)).must_equal "
Next › "
end
it 'renders the next link for page 3' do
pagy = Pagy.new count: 1000, page: 3
pagy_countless = Pagy::Countless.new(page: 3).finalize(21)
- view.pagy_next_link(pagy).must_equal "
Next › "
- view.pagy_next_link(pagy_countless).must_equal "
Next › "
+ _(view.pagy_next_link(pagy)).must_equal "
Next › "
+ _(view.pagy_next_link(pagy_countless)).must_equal "
Next › "
end
it 'renders the next link for page 6' do
pagy = Pagy.new count: 1000, page: 6
pagy_countless = Pagy::Countless.new(page: 6).finalize(21)
- view.pagy_next_link(pagy).must_equal "
Next › "
- view.pagy_next_link(pagy_countless).must_equal "
Next › "
+ _(view.pagy_next_link(pagy)).must_equal "
Next › "
+ _(view.pagy_next_link(pagy_countless)).must_equal "
Next › "
end
it 'renders the next link for last page' do
pagy = Pagy.new count: 1000, page: 50
pagy_countless = Pagy::Countless.new(page: 50).finalize(20)
- view.pagy_next_link(pagy).must_equal "
Next › "
- view.pagy_next_link(pagy_countless).must_equal "
Next › "
+ _(view.pagy_next_link(pagy)).must_equal "
Next › "
+ _(view.pagy_next_link(pagy_countless)).must_equal "
Next › "
end
end
diff --git a/test/pagy/extras/trim_test.rb b/test/pagy/extras/trim_test.rb
index 6bff241ad..9f7609e64 100644
--- a/test/pagy/extras/trim_test.rb
+++ b/test/pagy/extras/trim_test.rb
@@ -38,7 +38,7 @@
view = MockView.new("http://example.com:3000/foo#{generated}")
pagy = Pagy.new(count: 1000, page: page)
link = view.pagy_link_proc(pagy)
- link.call(page).must_equal("
#{page} ")
+ _(link.call(page)).must_equal("
#{page} ")
end
end
@@ -49,22 +49,19 @@
it 'renders first page' do
pagy = Pagy.new(count: 103, page: 1)
html = view.pagy_nav(pagy)
- html.must_equal \
- "
‹ Prev 1 2 3 4 5 6 Next › "
+ _(html).must_equal "
‹ Prev 1 2 3 4 5 6 Next › "
end
it 'renders intermediate page' do
pagy = Pagy.new(count: 103, page: 3)
html = view.pagy_nav(pagy)
- html.must_equal \
- "
‹ Prev 1 2 3 4 5 6 Next › "
+ _(html).must_equal "
‹ Prev 1 2 3 4 5 6 Next › "
end
it 'renders last page' do
pagy = Pagy.new(count: 103, page: 6)
html = view.pagy_nav(pagy)
- html.must_equal \
- "
‹ Prev 1 2 3 4 5 6 Next › "
+ _(html).must_equal "
‹ Prev 1 2 3 4 5 6 Next › "
end
end
@@ -73,30 +70,22 @@
it 'renders first page' do
pagy = Pagy.new(count: 103, page: 1)
- view.pagy_nav_js(pagy, pagy_test_id).must_equal \
- "
"
- view.pagy_bootstrap_nav_js(pagy, pagy_test_id).must_equal \
- "
"
- view.pagy_bulma_nav_js(pagy, pagy_test_id).must_equal \
- "
"
- view.pagy_foundation_nav_js(pagy, pagy_test_id).must_equal \
- "
"
- view.pagy_materialize_nav_js(pagy, pagy_test_id).must_equal \
- "
"
- view.pagy_semantic_nav_js(pagy, pagy_test_id).must_equal \
- "
"
+ _(view.pagy_nav_js(pagy, pagy_test_id)).must_equal "
"
+ _(view.pagy_bootstrap_nav_js(pagy, pagy_test_id)).must_equal "
"
+ _(view.pagy_bulma_nav_js(pagy, pagy_test_id)).must_equal "
"
+ _(view.pagy_foundation_nav_js(pagy, pagy_test_id)).must_equal "
"
+ _(view.pagy_materialize_nav_js(pagy, pagy_test_id)).must_equal "
"
+ _(view.pagy_semantic_nav_js(pagy, pagy_test_id)).must_equal "
"
end
it 'renders intermediate page' do
pagy = Pagy.new(count: 103, page: 3)
- view.pagy_nav_js(pagy, pagy_test_id).must_equal \
- "
"
+ _(view.pagy_nav_js(pagy, pagy_test_id)).must_equal "
"
end
it 'renders last page' do
pagy = Pagy.new(count: 103, page: 6)
- view.pagy_nav_js(pagy, pagy_test_id).must_equal \
- "
"
+ _(view.pagy_nav_js(pagy, pagy_test_id)).must_equal "
"
end
end
@@ -105,32 +94,24 @@
it 'renders first page' do
pagy = Pagy.new(count: 103, page: 1)
- view.pagy_combo_nav_js(pagy, pagy_test_id).must_equal \
- "
‹ Prev Page of 6 Next › "
- view.pagy_bootstrap_combo_nav_js(pagy, pagy_test_id).must_equal \
- "
"
- view.pagy_bulma_combo_nav_js(pagy, pagy_test_id).must_equal \
- "
"
- view.pagy_foundation_combo_nav_js(pagy, pagy_test_id).must_equal \
- "
"
- view.pagy_materialize_combo_nav_js(pagy, pagy_test_id).must_equal \
- "
"
- view.pagy_semantic_combo_nav_js(pagy, pagy_test_id).must_equal \
- "
"
+ _(view.pagy_combo_nav_js(pagy, pagy_test_id)).must_equal "
‹ Prev Page of 6 Next › "
+ _(view.pagy_bootstrap_combo_nav_js(pagy, pagy_test_id)).must_equal "
"
+ _(view.pagy_bulma_combo_nav_js(pagy, pagy_test_id)).must_equal "
"
+ _(view.pagy_foundation_combo_nav_js(pagy, pagy_test_id)).must_equal "
"
+ _(view.pagy_materialize_combo_nav_js(pagy, pagy_test_id)).must_equal "
"
+ _(view.pagy_semantic_combo_nav_js(pagy, pagy_test_id)).must_equal "
"
end
it 'renders intermediate page' do
pagy = Pagy.new(count: 103, page: 3)
html = view.pagy_combo_nav_js(pagy, pagy_test_id)
- html.must_equal \
- "
‹ Prev Page of 6 Next › "
+ _(html).must_equal "
‹ Prev Page of 6 Next › "
end
it 'renders last page' do
pagy = Pagy.new(count: 103, page: 6)
html = view.pagy_combo_nav_js(pagy, pagy_test_id)
- html.must_equal \
- "
‹ Prev Page of 6 Next › "
+ _(html).must_equal "
‹ Prev Page of 6 Next › "
end
end
diff --git a/test/pagy/extras/uikit_test.rb b/test/pagy/extras/uikit_test.rb
index bf2adb1fb..560364a38 100644
--- a/test/pagy/extras/uikit_test.rb
+++ b/test/pagy/extras/uikit_test.rb
@@ -13,19 +13,19 @@
it 'renders first page' do
pagy = Pagy.new(count: 1000, page: 1)
- view.pagy_uikit_nav(pagy).must_equal \
+ _(view.pagy_uikit_nav(pagy)).must_equal \
"
"
end
it 'renders intermediate page' do
pagy = Pagy.new(count: 1000, page: 20)
- view.pagy_uikit_nav(pagy).must_equal \
+ _(view.pagy_uikit_nav(pagy)).must_equal \
"
"
end
it 'renders last page' do
pagy = Pagy.new(count: 1000, page: 50)
- view.pagy_uikit_nav(pagy).must_equal \
+ _(view.pagy_uikit_nav(pagy)).must_equal \
"
"
end
@@ -35,19 +35,19 @@
it 'renders first page' do
pagy = Pagy.new(count: 1000, page: 1)
- view.pagy_uikit_nav_js(pagy, pagy_test_id).must_equal \
+ _(view.pagy_uikit_nav_js(pagy, pagy_test_id)).must_equal \
"
"
end
it 'renders intermediate page' do
pagy = Pagy.new(count: 1000, page: 20)
- view.pagy_uikit_nav_js(pagy, pagy_test_id).must_equal \
+ _(view.pagy_uikit_nav_js(pagy, pagy_test_id)).must_equal \
"
"
end
it 'renders last page' do
pagy = Pagy.new(count: 1000, page: 50)
- view.pagy_uikit_nav_js(pagy, pagy_test_id).must_equal \
+ _(view.pagy_uikit_nav_js(pagy, pagy_test_id)).must_equal \
"
"
end
@@ -57,19 +57,19 @@
it 'renders first page' do
pagy = Pagy.new(count: 1000, page: 1)
- view.pagy_uikit_combo_nav_js(pagy, pagy_test_id).must_equal \
+ _(view.pagy_uikit_combo_nav_js(pagy, pagy_test_id)).must_equal \
"
"
end
it 'renders intermediate page' do
pagy = Pagy.new(count: 1000, page: 20)
- view.pagy_uikit_combo_nav_js(pagy, pagy_test_id).must_equal \
+ _(view.pagy_uikit_combo_nav_js(pagy, pagy_test_id)).must_equal \
"
"
end
it 'renders last page' do
pagy = Pagy.new(count: 1000, page: 50)
- view.pagy_uikit_combo_nav_js(pagy, pagy_test_id).must_equal \
+ _(view.pagy_uikit_combo_nav_js(pagy, pagy_test_id)).must_equal \
"
"
end
diff --git a/test/pagy/frontend_test.rb b/test/pagy/frontend_test.rb
index 977334047..72af9a9a8 100644
--- a/test/pagy/frontend_test.rb
+++ b/test/pagy/frontend_test.rb
@@ -11,32 +11,32 @@
it 'renders page 1' do
pagy = Pagy.new count: 103, page: 1
- view.pagy_nav(pagy).must_equal \
+ _(view.pagy_nav(pagy)).must_equal \
"
‹ Prev 1 2 3 4 5 6 Next › "
end
it 'renders page 3' do
pagy = Pagy.new count: 103, page: 3
- view.pagy_nav(pagy).must_equal \
+ _(view.pagy_nav(pagy)).must_equal \
"
‹ Prev 1 2 3 4 5 6 Next › "
end
it 'renders page 6' do
pagy = Pagy.new count: 103, page: 6
- view.pagy_nav(pagy).must_equal \
+ _(view.pagy_nav(pagy)).must_equal \
"
‹ Prev 1 2 3 4 5 6 Next › "
end
it 'renders page 10' do
pagy = Pagy.new count: 1000, page: 10
- view.pagy_nav(pagy).must_equal \
+ _(view.pagy_nav(pagy)).must_equal \
"
‹ Prev 1 … 6 7 8 9 10 11 12 13 14 … 50 Next › "
end
it 'renders with link_extras' do
pagy = Pagy.new count: 103, page: 1, link_extra: "X"
- view.pagy_nav(pagy).must_include '?page=2" X rel'
+ _(view.pagy_nav(pagy)).must_include '?page=2" X rel'
end
end
@@ -45,7 +45,7 @@
it 'renders with extras' do
pagy = Pagy.new count: 103, page: 1
- view.pagy_link_proc(pagy, "X").call(1).must_equal '
1 '
+ _(view.pagy_link_proc(pagy, "X").call(1)).must_equal '
1 '
end
end
@@ -53,23 +53,23 @@
describe "#pagy_t" do
it 'pluralizes' do
- view.pagy_t('pagy.nav.prev').must_equal "‹ Prev"
- view.pagy_t('pagy.item_name', count: 0).must_equal "items"
- view.pagy_t('pagy.item_name', count: 1).must_equal "item"
- view.pagy_t('pagy.item_name', count: 10).must_equal "items"
+ _(view.pagy_t('pagy.nav.prev')).must_equal "‹ Prev"
+ _(view.pagy_t('pagy.item_name', count: 0)).must_equal "items"
+ _(view.pagy_t('pagy.item_name', count: 1)).must_equal "item"
+ _(view.pagy_t('pagy.item_name', count: 10)).must_equal "items"
end
it 'interpolates' do
- view.pagy_t('pagy.info.no_items', count: 0).must_equal "No %{item_name} found"
- view.pagy_t('pagy.info.single_page', count: 1).must_equal "Displaying
1 %{item_name}"
- view.pagy_t('pagy.info.single_page', count: 10).must_equal "Displaying
10 %{item_name}"
- view.pagy_t('pagy.info.multiple_pages', count: 10).must_equal "Displaying %{item_name}
%{from}-%{to} of
10 in total"
- view.pagy_t('pagy.info.multiple_pages', item_name: 'Products', count: 300, from: 101, to: 125).must_equal "Displaying Products
101-125 of
300 in total"
+ _(view.pagy_t('pagy.info.no_items', count: 0)).must_equal "No %{item_name} found"
+ _(view.pagy_t('pagy.info.single_page', count: 1)).must_equal "Displaying
1 %{item_name}"
+ _(view.pagy_t('pagy.info.single_page', count: 10)).must_equal "Displaying
10 %{item_name}"
+ _(view.pagy_t('pagy.info.multiple_pages', count: 10)).must_equal "Displaying %{item_name}
%{from}-%{to} of
10 in total"
+ _(view.pagy_t('pagy.info.multiple_pages', item_name: 'Products', count: 300, from: 101, to: 125)).must_equal "Displaying Products
101-125 of
300 in total"
end
it 'handles missing paths' do
- view.pagy_t('pagy.nav.not_here').must_equal '[translation missing: "pagy.nav.not_here"]'
- view.pagy_t('pagy.nav.gap.not_here').must_equal '[translation missing: "pagy.nav.gap.not_here"]'
+ _(view.pagy_t('pagy.nav.not_here')).must_equal '[translation missing: "pagy.nav.not_here"]'
+ _(view.pagy_t('pagy.nav.gap.not_here')).must_equal '[translation missing: "pagy.nav.gap.not_here"]'
end
end
@@ -77,30 +77,30 @@
describe "Pagy::I18n" do
it 'loads custom :locale, :filepath and :pluralize' do
- proc{ Pagy::I18n.load(locale: 'xx') }.must_raise Errno::ENOENT
- proc{ Pagy::I18n.load(locale: 'xx', filepath: Pagy.root.join('locales', 'en.yml'))}.must_raise Pagy::VariableError
- proc{ Pagy::I18n.load(locale: 'en', filepath: Pagy.root.join('locales', 'xx.yml')) }.must_raise Errno::ENOENT
+ _(proc{ Pagy::I18n.load(locale: 'xx') }).must_raise Errno::ENOENT
+ _(proc{ Pagy::I18n.load(locale: 'xx', filepath: Pagy.root.join('locales', 'en.yml'))}).must_raise Pagy::VariableError
+ _(proc{ Pagy::I18n.load(locale: 'en', filepath: Pagy.root.join('locales', 'xx.yml')) }).must_raise Errno::ENOENT
custom_dictionary = File.join(File.dirname(__FILE__), 'custom.yml')
Pagy::I18n.load(locale: 'custom', filepath: custom_dictionary)
- Pagy::I18n.t('custom', 'pagy.nav.prev').must_equal "‹ Custom Prev"
+ _(Pagy::I18n.t('custom', 'pagy.nav.prev')).must_equal "‹ Custom Prev"
Pagy::I18n.load(locale: 'en', pluralize: lambda{|_| 'one' }) # returns always 'one' regardless the count
- Pagy::I18n.t(nil, 'pagy.item_name', count: 0).must_equal "item"
- Pagy::I18n.t('en', 'pagy.item_name', count: 0).must_equal "item"
- Pagy::I18n.t('en', 'pagy.item_name', count: 1).must_equal "item"
- Pagy::I18n.t('en', 'pagy.item_name', count: 10).must_equal "item"
+ _(Pagy::I18n.t(nil, 'pagy.item_name', count: 0)).must_equal "item"
+ _(Pagy::I18n.t('en', 'pagy.item_name', count: 0)).must_equal "item"
+ _(Pagy::I18n.t('en', 'pagy.item_name', count: 1)).must_equal "item"
+ _(Pagy::I18n.t('en', 'pagy.item_name', count: 10)).must_equal "item"
Pagy::I18n.load(locale: 'en') # reset for other tests
end
it 'switches :locale according to @pagy_locale' do
Pagy::I18n.load({locale: 'de'}, {locale: 'en'}, {locale: 'nl'})
view.instance_variable_set(:'@pagy_locale', 'nl')
- view.pagy_t('pagy.item_name', count: 1).must_equal "stuk"
+ _(view.pagy_t('pagy.item_name', count: 1)).must_equal "stuk"
view.instance_variable_set(:'@pagy_locale', 'en')
- view.pagy_t('pagy.item_name', count: 1).must_equal "item"
+ _(view.pagy_t('pagy.item_name', count: 1)).must_equal "item"
view.instance_variable_set(:'@pagy_locale', nil)
- view.pagy_t('pagy.item_name', count: 1).must_equal "Eintrag"
+ _(view.pagy_t('pagy.item_name', count: 1)).must_equal "Eintrag"
view.instance_variable_set(:'@pagy_locale', 'unknown')
- view.pagy_t('pagy.item_name', count: 1).must_equal "Eintrag" # silently serves the first loaded locale
+ _(view.pagy_t('pagy.item_name', count: 1)).must_equal "Eintrag" # silently serves the first loaded locale
Pagy::I18n.load(locale: 'en') # reset for other tests
view.instance_variable_set(:'@pagy_locale', nil) # reset for other tests
end
@@ -110,19 +110,19 @@
describe "#pagy_info" do
it 'renders without i18n path' do
- view.pagy_info(Pagy.new count: 0).must_equal "No items found"
- view.pagy_info(Pagy.new count: 1).must_equal "Displaying
1 item"
- view.pagy_info(Pagy.new count: 13).must_equal "Displaying
13 items"
- view.pagy_info(Pagy.new count: 100, page: 3).must_equal "Displaying items
41-60 of
100 in total"
+ _(view.pagy_info(Pagy.new count: 0)).must_equal "No items found"
+ _(view.pagy_info(Pagy.new count: 1)).must_equal "Displaying
1 item"
+ _(view.pagy_info(Pagy.new count: 13)).must_equal "Displaying
13 items"
+ _(view.pagy_info(Pagy.new count: 100, page: 3)).must_equal "Displaying items
41-60 of
100 in total"
end
it 'renders with existing i18n path' do
Pagy::I18n['en'][0]['pagy.info.product.one'] = lambda{|_| 'Product'}
Pagy::I18n['en'][0]['pagy.info.product.other'] = lambda{|_| 'Products'}
- view.pagy_info(Pagy.new count: 0, i18n_key: 'pagy.info.product').must_equal "No Products found"
- view.pagy_info(Pagy.new count: 1, i18n_key: 'pagy.info.product').must_equal "Displaying
1 Product"
- view.pagy_info(Pagy.new count: 13, i18n_key: 'pagy.info.product').must_equal "Displaying
13 Products"
- view.pagy_info(Pagy.new count: 100, i18n_key: 'pagy.info.product', page: 3).must_equal "Displaying Products
41-60 of
100 in total"
+ _(view.pagy_info(Pagy.new count: 0, i18n_key: 'pagy.info.product')).must_equal "No Products found"
+ _(view.pagy_info(Pagy.new count: 1, i18n_key: 'pagy.info.product')).must_equal "Displaying
1 Product"
+ _(view.pagy_info(Pagy.new count: 13, i18n_key: 'pagy.info.product')).must_equal "Displaying
13 Products"
+ _(view.pagy_info(Pagy.new count: 100, i18n_key: 'pagy.info.product', page: 3)).must_equal "Displaying Products
41-60 of
100 in total"
Pagy::I18n.load(locale: 'en') # reset for other tests
end
end
@@ -131,26 +131,26 @@
it 'renders basic url' do
pagy = Pagy.new count: 1000, page: 3
- view.pagy_url_for(5, pagy). must_equal '/foo?page=5'
- view.pagy_url_for(5, pagy, :url). must_equal 'http://example.com:3000/foo?page=5'
+ _(view.pagy_url_for(5, pagy)).must_equal '/foo?page=5'
+ _(view.pagy_url_for(5, pagy, :url)).must_equal 'http://example.com:3000/foo?page=5'
end
it 'renders url with params' do
pagy = Pagy.new count: 1000, page: 3, params: {a: 3, b: 4}
- view.pagy_url_for(5, pagy).must_equal "/foo?page=5&a=3&b=4"
- view.pagy_url_for(5, pagy, :url).must_equal "http://example.com:3000/foo?page=5&a=3&b=4"
+ _(view.pagy_url_for(5, pagy)).must_equal "/foo?page=5&a=3&b=4"
+ _(view.pagy_url_for(5, pagy, :url)).must_equal "http://example.com:3000/foo?page=5&a=3&b=4"
end
it 'renders url with anchor' do
pagy = Pagy.new count: 1000, page: 3, anchor: '#anchor'
- view.pagy_url_for(6, pagy).must_equal '/foo?page=6#anchor'
- view.pagy_url_for(6, pagy, :url).must_equal 'http://example.com:3000/foo?page=6#anchor'
+ _(view.pagy_url_for(6, pagy)).must_equal '/foo?page=6#anchor'
+ _(view.pagy_url_for(6, pagy, :url)).must_equal 'http://example.com:3000/foo?page=6#anchor'
end
it 'renders url with params and anchor' do
pagy = Pagy.new count: 1000, page: 3, params: {a: 3, b: 4}, anchor: '#anchor'
- view.pagy_url_for(5, pagy).must_equal "/foo?page=5&a=3&b=4#anchor"
- view.pagy_url_for(5, pagy, :url).must_equal "http://example.com:3000/foo?page=5&a=3&b=4#anchor"
+ _(view.pagy_url_for(5, pagy)).must_equal "/foo?page=5&a=3&b=4#anchor"
+ _(view.pagy_url_for(5, pagy, :url)).must_equal "http://example.com:3000/foo?page=5&a=3&b=4#anchor"
end
end
@@ -160,7 +160,7 @@
it 'overrides params' do
overridden = MockView::Overridden.new
pagy = Pagy.new count: 1000, page: 3, params: {a: 3, b: 4}, anchor: '#anchor'
- overridden.pagy_url_for(5, pagy).must_equal "/foo?page=5&b=4&k=k#anchor"
+ _(overridden.pagy_url_for(5, pagy)).must_equal "/foo?page=5&b=4&k=k#anchor"
end
end
diff --git a/test/pagy_test.rb b/test/pagy_test.rb
index 23f85ccb7..0c0028bfd 100644
--- a/test/pagy_test.rb
+++ b/test/pagy_test.rb
@@ -8,7 +8,7 @@
let(:pagy) { Pagy.new count: 100, page: 4 }
it 'has version' do
- Pagy::VERSION.wont_be_nil
+ _(Pagy::VERSION).wont_be_nil
end
describe "#initialize" do
@@ -18,254 +18,258 @@
end
it 'initializes' do
- pagy.must_be_instance_of Pagy
- Pagy.new(count: 100).must_be_instance_of Pagy
- Pagy.new(count: '100').must_be_instance_of Pagy
- Pagy.new(count: 100, page: '2').must_be_instance_of Pagy
- Pagy.new(count: 100, page: '').must_be_instance_of Pagy
- Pagy.new(count: 100, items: '10').must_be_instance_of Pagy
- proc { Pagy.new({}) }.must_raise Pagy::VariableError
- proc { Pagy.new(count: 100, page: 0) }.must_raise Pagy::VariableError
- proc { Pagy.new(count: 100, page: 2, items: 0) }.must_raise Pagy::VariableError
- proc { Pagy.new(count: 100, page: 2, size: [1, 2, 3]).series }.must_raise Pagy::VariableError
- proc { Pagy.new(count: 100, page: 2, size: [1, 2, 3, '4']).series }.must_raise Pagy::VariableError
- proc { Pagy.new(count: 100, page: '11') }.must_raise Pagy::OverflowError
- e = proc { Pagy.new(count: 100, page: 12) }.must_raise Pagy::OverflowError
- e.pagy.must_be_instance_of Pagy
+ _(pagy).must_be_instance_of Pagy
+ _(Pagy.new(count: 100)).must_be_instance_of Pagy
+ _(Pagy.new(count: '100')).must_be_instance_of Pagy
+ _(Pagy.new(count: 100, page: '2')).must_be_instance_of Pagy
+ _(Pagy.new(count: 100, page: '')).must_be_instance_of Pagy
+ _(Pagy.new(count: 100, items: '10')).must_be_instance_of Pagy
+ _(proc { Pagy.new({}) }).must_raise Pagy::VariableError
+ _(proc { Pagy.new(count: 100, page: 0) }).must_raise Pagy::VariableError
+ _(proc { Pagy.new(count: 100, page: 2, items: 0) }).must_raise Pagy::VariableError
+ _(proc { Pagy.new(count: 100, page: 2, size: [1, 2, 3]).series }).must_raise Pagy::VariableError
+ _(proc { Pagy.new(count: 100, page: 2, size: [1, 2, 3, '4']).series }).must_raise Pagy::VariableError
+ _(proc { Pagy.new(count: 100, page: '11') }).must_raise Pagy::OverflowError
+ _(proc { Pagy.new(count: 100, page: 12) }).must_raise Pagy::OverflowError
+ begin
+ Pagy.new(count: 100, page: 12)
+ rescue => e
+ _(e.pagy).must_be_instance_of Pagy
+ end
end
it 'initializes count 0' do
pagy = Pagy.new @vars.merge(count: 0)
- pagy.pages.must_equal 1
- pagy.last.must_equal 1
- pagy.offset.must_equal 0
- pagy.from.must_equal 0
- pagy.to.must_equal 0
- pagy.prev.must_be_nil
- pagy.next.must_be_nil
+ _(pagy.pages).must_equal 1
+ _(pagy.last).must_equal 1
+ _(pagy.offset).must_equal 0
+ _(pagy.from).must_equal 0
+ _(pagy.to).must_equal 0
+ _(pagy.prev).must_be_nil
+ _(pagy.next).must_be_nil
end
it 'initializes single page' do
pagy = Pagy.new @vars.merge(count: 8)
- pagy.pages.must_equal 1
- pagy.last.must_equal 1
- pagy.offset.must_equal 0
- pagy.from.must_equal 1
- pagy.to.must_equal 8
- pagy.prev.must_be_nil
- pagy.next.must_be_nil
+ _(pagy.pages).must_equal 1
+ _(pagy.last).must_equal 1
+ _(pagy.offset).must_equal 0
+ _(pagy.from).must_equal 1
+ _(pagy.to).must_equal 8
+ _(pagy.prev).must_be_nil
+ _(pagy.next).must_be_nil
end
it 'initializes page 1 of 2' do
pagy = Pagy.new @vars.merge(count: 15)
- pagy.pages.must_equal 2
- pagy.last.must_equal 2
- pagy.offset.must_equal 0
- pagy.from.must_equal 1
- pagy.to.must_equal 10
- pagy.prev.must_be_nil
- pagy.next.must_equal 2
+ _(pagy.pages).must_equal 2
+ _(pagy.last).must_equal 2
+ _(pagy.offset).must_equal 0
+ _(pagy.from).must_equal 1
+ _(pagy.to).must_equal 10
+ _(pagy.prev).must_be_nil
+ _(pagy.next).must_equal 2
end
it 'initializes page 2 of 2' do
pagy = Pagy.new @vars.merge(count: 15, page: 2)
- pagy.pages.must_equal 2
- pagy.last.must_equal 2
- pagy.offset.must_equal 10
- pagy.from.must_equal 11
- pagy.to.must_equal 15
- pagy.prev.must_equal 1
- pagy.page.must_equal 2
- pagy.next.must_be_nil
+ _(pagy.pages).must_equal 2
+ _(pagy.last).must_equal 2
+ _(pagy.offset).must_equal 10
+ _(pagy.from).must_equal 11
+ _(pagy.to).must_equal 15
+ _(pagy.prev).must_equal 1
+ _(pagy.page).must_equal 2
+ _(pagy.next).must_be_nil
end
it 'initializes page 1' do
pagy = Pagy.new @vars.merge(page: 1)
- pagy.count.must_equal 103
- pagy.pages.must_equal 11
- pagy.last.must_equal 11
- pagy.items.must_equal 10
- pagy.offset.must_equal 0
- pagy.from.must_equal 1
- pagy.to.must_equal 10
- pagy.prev.must_be_nil
- pagy.page.must_equal 1
- pagy.next.must_equal 2
+ _(pagy.count).must_equal 103
+ _(pagy.pages).must_equal 11
+ _(pagy.last).must_equal 11
+ _(pagy.items).must_equal 10
+ _(pagy.offset).must_equal 0
+ _(pagy.from).must_equal 1
+ _(pagy.to).must_equal 10
+ _(pagy.prev).must_be_nil
+ _(pagy.page).must_equal 1
+ _(pagy.next).must_equal 2
end
it 'initializes page 2' do
pagy = Pagy.new @vars.merge(page: 2)
- pagy.count.must_equal 103
- pagy.pages.must_equal 11
- pagy.last.must_equal 11
- pagy.items.must_equal 10
- pagy.offset.must_equal 10
- pagy.from.must_equal 11
- pagy.to.must_equal 20
- pagy.prev.must_equal 1
- pagy.page.must_equal 2
- pagy.next.must_equal 3
+ _(pagy.count).must_equal 103
+ _(pagy.pages).must_equal 11
+ _(pagy.last).must_equal 11
+ _(pagy.items).must_equal 10
+ _(pagy.offset).must_equal 10
+ _(pagy.from).must_equal 11
+ _(pagy.to).must_equal 20
+ _(pagy.prev).must_equal 1
+ _(pagy.page).must_equal 2
+ _(pagy.next).must_equal 3
end
it 'initializes page 3' do
pagy = Pagy.new @vars.merge(page: 3)
- pagy.count.must_equal 103
- pagy.pages.must_equal 11
- pagy.last.must_equal 11
- pagy.items.must_equal 10
- pagy.offset.must_equal 20
- pagy.from.must_equal 21
- pagy.to.must_equal 30
- pagy.prev.must_equal 2
- pagy.page.must_equal 3
- pagy.next.must_equal 4
+ _(pagy.count).must_equal 103
+ _(pagy.pages).must_equal 11
+ _(pagy.last).must_equal 11
+ _(pagy.items).must_equal 10
+ _(pagy.offset).must_equal 20
+ _(pagy.from).must_equal 21
+ _(pagy.to).must_equal 30
+ _(pagy.prev).must_equal 2
+ _(pagy.page).must_equal 3
+ _(pagy.next).must_equal 4
end
it 'initializes page 4' do
pagy = Pagy.new @vars.merge(page: 4)
- pagy.count.must_equal 103
- pagy.pages.must_equal 11
- pagy.last.must_equal 11
- pagy.items.must_equal 10
- pagy.offset.must_equal 30
- pagy.from.must_equal 31
- pagy.to.must_equal 40
- pagy.prev.must_equal 3
- pagy.page.must_equal 4
- pagy.next.must_equal 5
+ _(pagy.count).must_equal 103
+ _(pagy.pages).must_equal 11
+ _(pagy.last).must_equal 11
+ _(pagy.items).must_equal 10
+ _(pagy.offset).must_equal 30
+ _(pagy.from).must_equal 31
+ _(pagy.to).must_equal 40
+ _(pagy.prev).must_equal 3
+ _(pagy.page).must_equal 4
+ _(pagy.next).must_equal 5
end
it 'initializes page 5' do
pagy = Pagy.new @vars.merge(page: 5)
- pagy.count.must_equal 103
- pagy.pages.must_equal 11
- pagy.last.must_equal 11
- pagy.items.must_equal 10
- pagy.offset.must_equal 40
- pagy.from.must_equal 41
- pagy.to.must_equal 50
- pagy.prev.must_equal 4
- pagy.page.must_equal 5
- pagy.next.must_equal 6
+ _(pagy.count).must_equal 103
+ _(pagy.pages).must_equal 11
+ _(pagy.last).must_equal 11
+ _(pagy.items).must_equal 10
+ _(pagy.offset).must_equal 40
+ _(pagy.from).must_equal 41
+ _(pagy.to).must_equal 50
+ _(pagy.prev).must_equal 4
+ _(pagy.page).must_equal 5
+ _(pagy.next).must_equal 6
end
it 'initializes page 6' do
pagy = Pagy.new @vars.merge(page: 6)
- pagy.count.must_equal 103
- pagy.pages.must_equal 11
- pagy.last.must_equal 11
- pagy.items.must_equal 10
- pagy.offset.must_equal 50
- pagy.from.must_equal 51
- pagy.to.must_equal 60
- pagy.prev.must_equal 5
- pagy.page.must_equal 6
- pagy.next.must_equal 7
+ _(pagy.count).must_equal 103
+ _(pagy.pages).must_equal 11
+ _(pagy.last).must_equal 11
+ _(pagy.items).must_equal 10
+ _(pagy.offset).must_equal 50
+ _(pagy.from).must_equal 51
+ _(pagy.to).must_equal 60
+ _(pagy.prev).must_equal 5
+ _(pagy.page).must_equal 6
+ _(pagy.next).must_equal 7
end
it 'initializes page 7' do
pagy = Pagy.new @vars.merge(page: 7)
- pagy.count.must_equal 103
- pagy.pages.must_equal 11
- pagy.last.must_equal 11
- pagy.items.must_equal 10
- pagy.offset.must_equal 60
- pagy.from.must_equal 61
- pagy.to.must_equal 70
- pagy.prev.must_equal 6
- pagy.page.must_equal 7
- pagy.next.must_equal 8
+ _(pagy.count).must_equal 103
+ _(pagy.pages).must_equal 11
+ _(pagy.last).must_equal 11
+ _(pagy.items).must_equal 10
+ _(pagy.offset).must_equal 60
+ _(pagy.from).must_equal 61
+ _(pagy.to).must_equal 70
+ _(pagy.prev).must_equal 6
+ _(pagy.page).must_equal 7
+ _(pagy.next).must_equal 8
end
it 'initializes page 8' do
pagy = Pagy.new @vars.merge(page: 8)
- pagy.count.must_equal 103
- pagy.pages.must_equal 11
- pagy.last.must_equal 11
- pagy.items.must_equal 10
- pagy.offset.must_equal 70
- pagy.from.must_equal 71
- pagy.to.must_equal 80
- pagy.prev.must_equal 7
- pagy.page.must_equal 8
- pagy.next.must_equal 9
+ _(pagy.count).must_equal 103
+ _(pagy.pages).must_equal 11
+ _(pagy.last).must_equal 11
+ _(pagy.items).must_equal 10
+ _(pagy.offset).must_equal 70
+ _(pagy.from).must_equal 71
+ _(pagy.to).must_equal 80
+ _(pagy.prev).must_equal 7
+ _(pagy.page).must_equal 8
+ _(pagy.next).must_equal 9
end
it 'initializes page 9' do
pagy = Pagy.new @vars.merge(page: 9)
- pagy.count.must_equal 103
- pagy.pages.must_equal 11
- pagy.last.must_equal 11
- pagy.items.must_equal 10
- pagy.offset.must_equal 80
- pagy.from.must_equal 81
- pagy.to.must_equal 90
- pagy.prev.must_equal 8
- pagy.page.must_equal 9
- pagy.next.must_equal 10
+ _(pagy.count).must_equal 103
+ _(pagy.pages).must_equal 11
+ _(pagy.last).must_equal 11
+ _(pagy.items).must_equal 10
+ _(pagy.offset).must_equal 80
+ _(pagy.from).must_equal 81
+ _(pagy.to).must_equal 90
+ _(pagy.prev).must_equal 8
+ _(pagy.page).must_equal 9
+ _(pagy.next).must_equal 10
end
it 'initializes page 10' do
pagy = Pagy.new @vars.merge(page: 10)
- pagy.count.must_equal 103
- pagy.pages.must_equal 11
- pagy.last.must_equal 11
- pagy.items.must_equal 10
- pagy.offset.must_equal 90
- pagy.from.must_equal 91
- pagy.to.must_equal 100
- pagy.prev.must_equal 9
- pagy.page.must_equal 10
- pagy.next.must_equal 11
+ _(pagy.count).must_equal 103
+ _(pagy.pages).must_equal 11
+ _(pagy.last).must_equal 11
+ _(pagy.items).must_equal 10
+ _(pagy.offset).must_equal 90
+ _(pagy.from).must_equal 91
+ _(pagy.to).must_equal 100
+ _(pagy.prev).must_equal 9
+ _(pagy.page).must_equal 10
+ _(pagy.next).must_equal 11
end
it 'initializes page 11' do
pagy = Pagy.new @vars.merge(page: 11)
- pagy.count.must_equal 103
- pagy.pages.must_equal 11
- pagy.last.must_equal 11
- pagy.items.must_equal 3
- pagy.offset.must_equal 100
- pagy.from.must_equal 101
- pagy.to.must_equal 103
- pagy.prev.must_equal 10
- pagy.page.must_equal 11
- pagy.next.must_be_nil
+ _(pagy.count).must_equal 103
+ _(pagy.pages).must_equal 11
+ _(pagy.last).must_equal 11
+ _(pagy.items).must_equal 3
+ _(pagy.offset).must_equal 100
+ _(pagy.from).must_equal 101
+ _(pagy.to).must_equal 103
+ _(pagy.prev).must_equal 10
+ _(pagy.page).must_equal 11
+ _(pagy.next).must_be_nil
end
it 'initializes outset page 1' do
pagy = Pagy.new(count: 87, page: 1, outset: 10, items: 10)
- pagy.offset.must_equal 10
- pagy.items.must_equal 10
- pagy.from.must_equal 1
- pagy.to.must_equal 10
- pagy.pages.must_equal 9
+ _(pagy.offset).must_equal 10
+ _(pagy.items).must_equal 10
+ _(pagy.from).must_equal 1
+ _(pagy.to).must_equal 10
+ _(pagy.pages).must_equal 9
end
it 'initializes outset page 9' do
pagy = Pagy.new(count: 87, page: 9, outset: 10, items: 10)
- pagy.offset.must_equal 90
- pagy.items.must_equal 7
- pagy.from.must_equal 81
- pagy.to.must_equal 87
- pagy.pages.must_equal 9
+ _(pagy.offset).must_equal 90
+ _(pagy.items).must_equal 7
+ _(pagy.from).must_equal 81
+ _(pagy.to).must_equal 87
+ _(pagy.pages).must_equal 9
end
it 'initializes items of last page of one' do
- Pagy.new(items: 10, count: 0).items.must_equal 10
- Pagy.new(items: 10, count: 4).items.must_equal 4
- Pagy.new(items: 10, count: 10).items.must_equal 10
+ _(Pagy.new(items: 10, count: 0).items).must_equal 10
+ _(Pagy.new(items: 10, count: 4).items).must_equal 4
+ _(Pagy.new(items: 10, count: 10).items).must_equal 10
end
it 'initializes items of last page of many' do
- Pagy.new(items: 10, count: 14, page: 2).items.must_equal 4
- Pagy.new(items: 10, count: 20, page: 2).items.must_equal 10
+ _(Pagy.new(items: 10, count: 14, page: 2).items).must_equal 4
+ _(Pagy.new(items: 10, count: 20, page: 2).items).must_equal 10
end
it 'handles the :cycle variable' do
pagy = Pagy.new(count: 100, page: 10, items: 10, cycle: true)
- pagy.prev.must_equal(9)
- pagy.next.must_equal 1
+ _(pagy.prev).must_equal(9)
+ _(pagy.next).must_equal 1
end
end
@@ -277,7 +281,7 @@
:count, :page, :items, :vars, # input
:offset, :pages, :last, :from, :to, :prev, :next, :series # output
].each do |meth|
- pagy.must_respond_to meth
+ _(pagy).must_respond_to meth
end
end
@@ -286,12 +290,12 @@
describe "variables" do
it 'has vars defaults' do
- Pagy::VARS[:page].must_equal 1
- Pagy::VARS[:items].must_equal 20
- Pagy::VARS[:outset].must_equal 0
- Pagy::VARS[:size].must_equal [1, 4, 4, 1]
- Pagy::VARS[:page_param].must_equal :page
- Pagy::VARS[:params].must_equal({})
+ _(Pagy::VARS[:page]).must_equal 1
+ _(Pagy::VARS[:items]).must_equal 20
+ _(Pagy::VARS[:outset]).must_equal 0
+ _(Pagy::VARS[:size]).must_equal [1, 4, 4, 1]
+ _(Pagy::VARS[:page_param]).must_equal :page
+ _(Pagy::VARS[:params]).must_equal({})
end
end
@@ -316,7 +320,7 @@
def series_for(page, *expected)
expected.each_with_index do |value, index|
vars = instance_variable_get(:"@vars#{index}").merge(page: page)
- Pagy.new(vars).series.must_equal value
+ _(Pagy.new(vars).series).must_equal value
end
end
@@ -409,23 +413,23 @@ def series_for(page, *expected)
end
it 'computes series for count 0' do
- Pagy.new(@vars3.merge(count: 0)).series.must_equal ["1"]
+ _(Pagy.new(@vars3.merge(count: 0)).series).must_equal ["1"]
end
it 'computes series for single page' do
- Pagy.new(@vars3.merge(count: 8)).series.must_equal ["1"]
+ _(Pagy.new(@vars3.merge(count: 8)).series).must_equal ["1"]
end
it 'computes series for 1 of 2 pages' do
- Pagy.new(@vars3.merge(count: 15)).series.must_equal ["1", 2]
+ _(Pagy.new(@vars3.merge(count: 15)).series).must_equal ["1", 2]
end
it 'computes series for 2 of 2 pages' do
- Pagy.new(@vars3.merge(count: 15, page: 2)).series.must_equal [1, "2"]
+ _(Pagy.new(@vars3.merge(count: 15, page: 2)).series).must_equal [1, "2"]
end
it 'computes an empty series' do
- Pagy.new(@vars3.merge(count: 100, size: [])).series.must_equal []
+ _(Pagy.new(@vars3.merge(count: 100, size: [])).series).must_equal []
end
end