aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorNicholas Seckar <nseckar@gmail.com>2005-07-15 15:00:39 +0000
committerNicholas Seckar <nseckar@gmail.com>2005-07-15 15:00:39 +0000
commitc0771fe7d8f8a4fb9e86fba40d096b6f04f34e7d (patch)
tree0b3baa51769224f8d5d6aed270e7e9d87325efa4 /actionpack/lib
parentf45d8d81bfdef59ce81295322ec2c3c89ca1ed8f (diff)
downloadrails-c0771fe7d8f8a4fb9e86fba40d096b6f04f34e7d.tar.gz
rails-c0771fe7d8f8a4fb9e86fba40d096b6f04f34e7d.tar.bz2
rails-c0771fe7d8f8a4fb9e86fba40d096b6f04f34e7d.zip
Fix assert_routing with nested controllers. Closes #1582 and #1386.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1837 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_controller/assertions.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/actionpack/lib/action_controller/assertions.rb b/actionpack/lib/action_controller/assertions.rb
index e04d4ccde0..20650c8654 100644
--- a/actionpack/lib/action_controller/assertions.rb
+++ b/actionpack/lib/action_controller/assertions.rb
@@ -138,12 +138,7 @@ module Test #:nodoc:
# Load routes.rb if it hasn't been loaded.
ActionController::Routing::Routes.reload if ActionController::Routing::Routes.empty?
- # Assume given controller
- request = ActionController::TestRequest.new({}, {}, nil)
- request.path_parameters = (defaults or {}).clone
- request.path_parameters[:controller] ||= options[:controller]
-
- generated_path, found_extras = ActionController::Routing::Routes.generate(options, request)
+ generated_path, found_extras = ActionController::Routing::Routes.generate(options, extras)
msg = build_message(message, "found extras <?>, not <?>", found_extras, extras)
assert_block(msg) { found_extras == extras }
@@ -156,6 +151,12 @@ module Test #:nodoc:
# options is same as path, and also that the options recognized from path are same as options
def assert_routing(path, options, defaults={}, extras={}, message=nil)
assert_recognizes(options, path, extras, message)
+
+ controller, default_controller = options[:controller], defaults[:controller]
+ if controller && controller.include?(?/) && default_controller && default_controller.include?(?/)
+ options[:controller] = "/#{controller}"
+ end
+
assert_generates(path, options, defaults, extras, message)
end