diff options
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_controller/assertions.rb | 7 | ||||
-rw-r--r-- | actionpack/lib/action_controller/routing.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_controller/test_process.rb | 7 |
3 files changed, 14 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/assertions.rb b/actionpack/lib/action_controller/assertions.rb index 4a6f4daae5..f2eb2fd2f4 100644 --- a/actionpack/lib/action_controller/assertions.rb +++ b/actionpack/lib/action_controller/assertions.rb @@ -26,6 +26,13 @@ module Test #:nodoc: # # For redirects within the same controller, you can even call follow_redirect and the redirect will be follow triggering another # action call which can then be asserted against. + # + # == Testing named routes + # + # If you're using named routes, they can be easily tested using the original named routes methods straight in the test case. + # Example: + # + # assert_redirected_to page_url(:title => 'foo') module Assertions # Asserts that the response is one of the following types: # diff --git a/actionpack/lib/action_controller/routing.rb b/actionpack/lib/action_controller/routing.rb index 3a1ef27234..184be83781 100644 --- a/actionpack/lib/action_controller/routing.rb +++ b/actionpack/lib/action_controller/routing.rb @@ -567,7 +567,7 @@ module ActionController protected url_helper_name(name), hash_access_name(name) - Helpers << url_helper_name(name) + Helpers << url_helper_name(name).to_sym Helpers.uniq! end diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb index 0480d50f57..93d9dd8a2f 100644 --- a/actionpack/lib/action_controller/test_process.rb +++ b/actionpack/lib/action_controller/test_process.rb @@ -324,6 +324,11 @@ module Test $:.unshift File.dirname(__FILE__) + "/vendor/html-scanner" require 'html/document' end - end + + def method_missing(selector, *args) + return @controller.send(selector, *args) if ActionController::Routing::NamedRoutes::Helpers.include?(selector) + return super + end + end end end |