Skip to content

Commit

Permalink
removed fork from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed Feb 22, 2019
1 parent 532743d commit 8550b67
Showing 1 changed file with 20 additions and 22 deletions.
42 changes: 20 additions & 22 deletions test/pagy/extras/items_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,16 @@
end

it 'doesn\'t limit the items from default' do
fork{
vars = {}
Pagy::VARS[:max_items] = nil
params = {:a=>"a", :items=>1000}
backend = TestController.new params
backend.params.must_equal params
pagy, _ = backend.send :pagy, @collection, vars
pagy.items.must_equal 1000
pagy_countless, _ = backend.send :pagy_countless, @collection, vars
pagy_countless.items.must_equal 1000
}
vars = {}
params = {:a=>"a", :items=>1000}
backend = TestController.new params
backend.params.must_equal params
Pagy::VARS[:max_items] = nil
pagy, _ = backend.send :pagy, @collection, vars
Pagy::VARS[:max_items] = 100
pagy.items.must_equal 1000
pagy_countless, _ = backend.send :pagy_countless, @collection, vars
pagy_countless.items.must_equal 1000
end

it 'uses items_param from vars' do
Expand All @@ -104,17 +103,16 @@
end

it 'uses items_param from default' do
fork{
vars = {}
Pagy::VARS[:items_param] = :custom
params = {:a=>"a", :page=>3, :custom=>15}
backend = TestController.new params
backend.params.must_equal params
pagy, _ = backend.send :pagy, @collection, vars
pagy.items.must_equal 15
pagy_countless, _ = backend.send :pagy_countless, @collection, vars
pagy_countless.items.must_equal 15
}
vars = {}
params = {:a=>"a", :page=>3, :custom=>15}
backend = TestController.new params
backend.params.must_equal params
Pagy::VARS[:items_param] = :custom
pagy, _ = backend.send :pagy, @collection, vars
Pagy::VARS[:items_param] = :items
pagy.items.must_equal 15
pagy_countless, _ = backend.send :pagy_countless, @collection, vars
pagy_countless.items.must_equal 15
end

end
Expand Down

0 comments on commit 8550b67

Please sign in to comment.