url_for now works with HashWithIndifferentAccess ht jay [#4391 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
This commit is contained in:
Santiago Pastorino 2010-04-21 01:33:48 -03:00 committed by Jeremy Kemper
parent 726b5d7984
commit 5c9c30ac65
2 changed files with 11 additions and 1 deletions

View File

@ -102,7 +102,7 @@ module ActionView
escape = true
options
when Hash
options = { :only_path => options[:host].nil? }.update(options.symbolize_keys)
options = { :only_path => options[:host].nil? }.update(options.to_hash.symbolize_keys)
escape = options.key?(:escape) ? options.delete(:escape) : false
super
when :back

View File

@ -421,6 +421,11 @@ class UrlHelperControllerTest < ActionController::TestCase
render :inline => "<%= url_for :controller => 'url_helper_controller_test/url_helper', :action => 'show_url_for' %>"
end
def show_overriden_url_for
params = { :controller => 'c', :action => 'a' }
render :inline => "<%= url_for params.merge(:controller => 'url_helper_controller_test/url_helper', :action => 'show_url_for') %>"
end
def show_named_route
render :inline => "<%= show_named_route_#{params[:kind]} %>"
end
@ -439,6 +444,11 @@ class UrlHelperControllerTest < ActionController::TestCase
assert_equal '/url_helper_controller_test/url_helper/show_url_for', @response.body
end
def test_overriden_url_for_shows_only_path
get :show_overriden_url_for
assert_equal '/url_helper_controller_test/url_helper/show_url_for', @response.body
end
def test_named_route_url_shows_host_and_path
get :show_named_route, :kind => 'url'
assert_equal 'http://test.host/url_helper_controller_test/url_helper/show_named_route',