diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-06-25 10:58:44 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-06-25 10:58:44 +0000 |
commit | 6f6c6b8bcb78169bcd6dd3aaa1c0410e7b36b567 (patch) | |
tree | cb7ee557ed08ce68043ad3088a6d5166c9b3d5b5 /actionpack | |
parent | deda0ee4a8008475629f020e0334f64cc05215c8 (diff) | |
download | rails-6f6c6b8bcb78169bcd6dd3aaa1c0410e7b36b567.tar.gz rails-6f6c6b8bcb78169bcd6dd3aaa1c0410e7b36b567.tar.bz2 rails-6f6c6b8bcb78169bcd6dd3aaa1c0410e7b36b567.zip |
Updated assert_generates/routing to the new Routes code #1498 [Rick Olson]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1505 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-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 |