aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template/url_helper_test.rb
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2017-01-04 23:34:56 -0500
committerGitHub <noreply@github.com>2017-01-04 23:34:56 -0500
commit333283e79dc45c294f6928adf6dc2f0a7a7dedde (patch)
tree65f05c8e8cfa9ffeb6e576200cd138f9942895cb /actionview/test/template/url_helper_test.rb
parent4f22406aae0221958eefaf5571cda4a68bc11a5d (diff)
parent13352f6972b4dbc9af33b0634a26184f1c4eb2c1 (diff)
downloadrails-333283e79dc45c294f6928adf6dc2f0a7a7dedde.tar.gz
rails-333283e79dc45c294f6928adf6dc2f0a7a7dedde.tar.bz2
rails-333283e79dc45c294f6928adf6dc2f0a7a7dedde.zip
Merge pull request #27549 from mpugach/consider_params_in_current_page
Add "check_parameters" option to "current_page?"
Diffstat (limited to 'actionview/test/template/url_helper_test.rb')
-rw-r--r--actionview/test/template/url_helper_test.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/actionview/test/template/url_helper_test.rb b/actionview/test/template/url_helper_test.rb
index 137eaba5a6..95bea21c8f 100644
--- a/actionview/test/template/url_helper_test.rb
+++ b/actionview/test/template/url_helper_test.rb
@@ -496,6 +496,15 @@ class UrlHelperTest < ActiveSupport::TestCase
assert current_page?("http://www.example.com/")
end
+ def test_current_page_considering_params
+ @request = request_for_url("/?order=desc&page=1")
+
+ assert !current_page?(url_hash, check_parameters: true)
+ assert !current_page?(url_hash.merge(check_parameters: true))
+ assert !current_page?(ActionController::Parameters.new(url_hash.merge(check_parameters: true)).permit!)
+ assert !current_page?("http://www.example.com/", check_parameters: true)
+ end
+
def test_current_page_with_params_that_match
@request = request_for_url("/?order=desc&page=1")