From ce60672342f8da447d24d25f8c0f2049fc81c0c8 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Mon, 19 Nov 2012 21:27:47 -0200 Subject: Correct the use of params options when given to url_for Merge url for tests and add changelog entry for #8233. --- actionpack/test/dispatch/request_test.rb | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'actionpack/test') diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb index 08d1c6fe73..f2bacf3e20 100644 --- a/actionpack/test/dispatch/request_test.rb +++ b/actionpack/test/dispatch/request_test.rb @@ -3,7 +3,7 @@ require 'abstract_unit' class RequestTest < ActiveSupport::TestCase def url_for(options = {}) - options.reverse_merge!(:host => 'www.example.com') + options = { host: 'www.example.com' }.merge!(options) ActionDispatch::Http::URL.url_for(options) end @@ -25,6 +25,8 @@ class RequestTest < ActiveSupport::TestCase assert_equal 'http://www.example.com/', url_for(:trailing_slash => true) assert_equal 'http://dhh:supersecret@www.example.com', url_for(:user => 'dhh', :password => 'supersecret') assert_equal 'http://www.example.com?search=books', url_for(:params => { :search => 'books' }) + assert_equal 'http://www.example.com?params=', url_for(:params => '') + assert_equal 'http://www.example.com?params=1', url_for(:params => 1) end test "remote ip" do @@ -799,14 +801,6 @@ class RequestTest < ActiveSupport::TestCase end end - test "url_for options[:params]" do - assert_equal 'http://www.example.com?params=', url_for(:params => '') - assert_equal 'http://www.example.com?params=1', url_for(:params => 1) - assert_equal 'http://www.example.com', url_for - assert_equal 'http://www.example.com', url_for(:params => {}) - assert_equal 'http://www.example.com?name=tumayun', url_for(:params => { :name => 'tumayun' }) - end - protected def stub_request(env = {}) -- cgit v1.2.3