Skip to content

Commit

Permalink
reconciliation between test strings
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed Mar 13, 2019
1 parent f78eef1 commit 5d6edf6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 0 additions & 2 deletions lib/pagy/frontend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ def pagy_url_for(page, pagy, path_or_url=:path)
"#{request.send(path_or_url)}?#{Rack::Utils.build_nested_query(pagy_get_params(params))}#{p_vars[:anchor]}"
end



# Sub-method called only by #pagy_url_for: here for easy customization of params by overriding
def pagy_get_params(params) params end
end
Expand Down
2 changes: 1 addition & 1 deletion test/pagy/extras/trim_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
pagy = Pagy.new(count: 1000, params: {a:3,b:4})
link = frontend.pagy_link_proc(pagy)
link.call(1).must_equal("<a href=\"/foo?a=3&b=4\" >1</a>")
link.call(10).must_equal("<a href=\"/foo?page=10&a=3&b=4\" >10</a>")
link.call(10).must_equal("<a href=\"/foo?a=3&b=4&page=10\" >10</a>")
end

end
Expand Down
6 changes: 3 additions & 3 deletions test/pagy/frontend_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@

it 'renders url with params' do
pagy = Pagy.new count: 1000, page: 3, params: {a: 3, b: 4}
frontend.pagy_url_for(5, pagy).must_equal '/foo?page=5&a=3&b=4'
frontend.pagy_url_for(5, pagy).must_equal "/foo?a=3&b=4&page=5"
end

it 'renders url with anchor' do
Expand All @@ -198,7 +198,7 @@

it 'renders url with params and anchor' do
pagy = Pagy.new count: 1000, page: 3, params: {a: 3, b: 4}, anchor: '#anchor'
frontend.pagy_url_for(5, pagy).must_equal '/foo?page=5&a=3&b=4#anchor'
frontend.pagy_url_for(5, pagy).must_equal "/foo?a=3&b=4&page=5#anchor"
end

end
Expand All @@ -208,7 +208,7 @@
it 'overrides params' do
overridden = TestViewOverride.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?b=4&page=5&k=k#anchor"
end

end
Expand Down

0 comments on commit 5d6edf6

Please sign in to comment.