aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/testing/assertions
diff options
context:
space:
mode:
authorMatt Fawcett <mail@matthewfawcett.co.uk>2012-02-24 13:16:31 +0000
committerMatt Fawcett <mail@matthewfawcett.co.uk>2012-02-24 13:16:31 +0000
commitd7bf930df5f508a0a201c8511376fb62fa22ff68 (patch)
treeb6840e594da4ccc6046f4df6eb2012018e140b30 /actionpack/lib/action_dispatch/testing/assertions
parent335fac56b671cd627ed55cbd41a62d3890342de4 (diff)
downloadrails-d7bf930df5f508a0a201c8511376fb62fa22ff68.tar.gz
rails-d7bf930df5f508a0a201c8511376fb62fa22ff68.tar.bz2
rails-d7bf930df5f508a0a201c8511376fb62fa22ff68.zip
Fix the assert_recognizes test method so that it works when there are
constraints on the querystring. Issue #2781
Diffstat (limited to 'actionpack/lib/action_dispatch/testing/assertions')
-rw-r--r--actionpack/lib/action_dispatch/testing/assertions/routing.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/testing/assertions/routing.rb b/actionpack/lib/action_dispatch/testing/assertions/routing.rb
index 1552676fbb..1f4b905d18 100644
--- a/actionpack/lib/action_dispatch/testing/assertions/routing.rb
+++ b/actionpack/lib/action_dispatch/testing/assertions/routing.rb
@@ -39,10 +39,9 @@ module ActionDispatch
# # Test a custom route
# assert_recognizes({:controller => 'items', :action => 'show', :id => '1'}, 'view/item1')
def assert_recognizes(expected_options, path, extras={}, message=nil)
- request = recognized_request_for(path)
+ request = recognized_request_for(path, extras)
expected_options = expected_options.clone
- extras.each_key { |key| expected_options.delete key } unless extras.nil?
expected_options.stringify_keys!
@@ -181,7 +180,7 @@ module ActionDispatch
private
# Recognizes the route for a given path.
- def recognized_request_for(path)
+ def recognized_request_for(path, extras = {})
if path.is_a?(Hash)
method = path[:method]
path = path[:path]
@@ -209,7 +208,7 @@ module ActionDispatch
request.request_method = method if method
- params = @routes.recognize_path(path, { :method => method })
+ params = @routes.recognize_path(path, { :method => method, :extras => extras })
request.path_parameters = params.with_indifferent_access
request