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
This commit is contained in:
Jamis Buck
2006-10-16 14:32:11 +00:00
parent 497b5dcf19
commit b5ec0fe313
3 changed files with 7 additions and 1 deletions

View File

@@ -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 File

@@ -40,7 +40,7 @@ module ActionController
# 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 File

@@ -310,6 +310,10 @@ HTML
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