Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Backport fix to allow :controller=>:some_symbol [norbert]

git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/1-2-stable@7838 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit f70b74a5bc4b5dbd415cf42a4a16a7ded173765e 1 parent 88f2284
@NZKoz NZKoz authored
View
1  actionpack/lib/action_controller/assertions/response_assertions.rb
@@ -69,6 +69,7 @@ def assert_redirected_to(options = {}, message=nil)
end
if value.respond_to?(:[]) && value['controller']
+ value['controller'] = value['controller'].to_s
if key == :actual && value['controller'].first != '/' && !value['controller'].include?('/')
new_controller_path = ActionController::Routing.controller_relative_to(value['controller'], @controller.class.controller_path)
value['controller'] = new_controller_path if value['controller'] != new_controller_path && ActionController::Routing.possible_controllers.include?(new_controller_path)
View
3  actionpack/lib/action_controller/routing.rb
@@ -1254,6 +1254,9 @@ def generate(options, recall = {}, method=:generate)
options = options_as_params(options)
expire_on = build_expiry(options, recall)
+ if options[:controller]
+ options[:controller] = options[:controller].to_s
+ end
# if the controller has changed, make sure it changes relative to the
# current controller module, if any. In other words, if we're currently
# on admin/get, and the new controller is 'set', the new controller
View
13 actionpack/test/controller/action_pack_assertions_test.rb
@@ -19,6 +19,8 @@ def redirect_to_action() redirect_to :action => "flash_me", :id => 1, :params =>
def redirect_to_controller() redirect_to :controller => "elsewhere", :action => "flash_me"; end
+ def redirect_to_controller_with_symbol() redirect_to :controller => :elsewhere, :action => :flash_me; end
+
def redirect_to_path() redirect_to '/some/path' end
def redirect_to_named_route() redirect_to route_one_url end
@@ -555,6 +557,17 @@ def test_redirected_to_url_full_url
assert_redirected_to 'http://test.host/some/path'
end
+ def test_assert_redirection_with_symbol
+ process :redirect_to_controller_with_symbol
+ assert_nothing_raised {
+ assert_redirected_to :controller => "elsewhere", :action => "flash_me"
+ }
+ process :redirect_to_controller_with_symbol
+ assert_nothing_raised {
+ assert_redirected_to :controller => :elsewhere, :action => :flash_me
+ }
+ end
+
def test_redirected_to_with_nested_controller
@controller = Admin::InnerModuleController.new
get :redirect_to_absolute_controller
View
4 actionpack/test/controller/url_rewriter_test.rb
@@ -160,6 +160,10 @@ def test_hash_recursive_and_array_parameters
assert_equal params[3], { 'query[person][position][]' => 'prof' }.to_query
end
+ def test_path_generation_for_symbol_parameter_keys
+ assert_generates("/image", :controller=> :image)
+ end
+
private
def extract_params(url)
url.split('?', 2).last.split('&')
Please sign in to comment.
Something went wrong with that request. Please try again.