diff options
-rw-r--r-- | actionpack/lib/action_controller/assertions.rb | 3 | ||||
-rw-r--r-- | actionpack/test/controller/test_test.rb | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/assertions.rb b/actionpack/lib/action_controller/assertions.rb index a419a65dfa..4a6f4daae5 100644 --- a/actionpack/lib/action_controller/assertions.rb +++ b/actionpack/lib/action_controller/assertions.rb @@ -94,6 +94,7 @@ module Test #:nodoc: # Asserts that the routing of the given path is handled correctly and that the parsed options match. def assert_recognizes(expected_options, path, extras={}, message=nil) + path = "/#{path}" unless path[0..0] == '/' # Load routes.rb if it hasn't been loaded. ActionController::Routing::Routes.reload if ActionController::Routing::Routes.empty? @@ -105,6 +106,7 @@ module Test #:nodoc: expected_options = expected_options.clone extras.each_key { |key| expected_options.delete key } unless extras.nil? + expected_options.stringify_keys! msg = build_message(message, "The recognized options <?> did not match <?>", request.path_parameters, expected_options) assert_block(msg) { request.path_parameters == expected_options } @@ -121,7 +123,6 @@ module Test #:nodoc: request.path_parameters[:controller] ||= options[:controller] generated_path, found_extras = ActionController::Routing::Routes.generate(options, request) - generated_path = generated_path.join('/') msg = build_message(message, "found extras <?>, not <?>", found_extras, extras) assert_block(msg) { found_extras == extras } diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb index 7b35447da5..ec067cc6c0 100644 --- a/actionpack/test/controller/test_test.rb +++ b/actionpack/test/controller/test_test.rb @@ -84,4 +84,8 @@ HTML :children => { :greater_than => 2, :only => { :tag => "li" } } } end + + def test_assert_routing + assert_generates 'controller/action/5', :controller => 'controller', :action => 'action', :id => '5' + end end |