Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix broken assert_generates when extra keys are being checked.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5309 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit b5ec0fe3133531f0cce5b8707f2ac831fdc57bea 1 parent 497b5dc
@jamis jamis authored
View
2  actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Fix broken assert_generates when extra keys are being checked. [Jamis Buck]
+
* Replace KCODE checks with String#chars for truncate. Closes #6385 [Manfred Stienstra]
* Make page caching respect the format of the resource that is being requested even if the current route is the default route so that, e.g. posts.rss is not transformed by url_for to '/' and subsequently cached as '/index.html' when it should be cached as '/posts.rss'. [Marcel Molina Jr.]
View
2  actionpack/lib/action_controller/assertions/routing_assertions.rb
@@ -40,7 +40,7 @@ def assert_generates(expected_path, options, defaults={}, extras = {}, message=n
# Load routes.rb if it hasn't been loaded.
ActionController::Routing::Routes.reload if ActionController::Routing::Routes.empty?
- generated_path, extra_keys = ActionController::Routing::Routes.generate_extras(options, extras)
+ generated_path, extra_keys = ActionController::Routing::Routes.generate_extras(options, defaults)
found_extras = options.reject {|k, v| ! extra_keys.include? k}
msg = build_message(message, "found extras <?>, not <?>", found_extras, extras)
View
4 actionpack/test/controller/test_test.rb
@@ -310,6 +310,10 @@ def test_assert_tag_content_matching
def test_assert_generates
assert_generates 'controller/action/5', :controller => 'controller', :action => 'action', :id => '5'
+ assert_generates 'controller/action/7', {:id => "7"}, {:controller => "controller", :action => "action"}
+ assert_generates 'controller/action/5', {:controller => "controller", :action => "action", :id => "5", :name => "bob"}, {}, {:name => "bob"}
+ assert_generates 'controller/action/7', {:id => "7", :name => "bob"}, {:controller => "controller", :action => "action"}, {:name => "bob"}
+ assert_generates 'controller/action/7', {:id => "7"}, {:controller => "controller", :action => "action", :name => "bob"}, {}
end
def test_assert_routing
Please sign in to comment.
Something went wrong with that request. Please try again.