Silence warning: ambiguous first argument; put parentheses or even spaces

This commit is contained in:
Bryan Helmkamp
2009-11-09 17:03:20 -05:00
parent 40f0ef7a37
commit b45d44cff0

View File

@@ -1102,21 +1102,21 @@ class LegacyRouteSetTests < ActiveSupport::TestCase
map.post 'post/:id', :controller=> 'post', :action=> 'show', :requirements => {:id => /\d+/}
end
exception = assert_raise(ActionController::RoutingError) { rs.generate(:controller => 'post', :action => 'show', :bad_param => "foo", :use_route => "post") }
assert_match /^post_url failed to generate/, exception.message
assert_match(/^post_url failed to generate/, exception.message)
from_match = exception.message.match(/from \{[^\}]+\}/).to_s
assert_match /:bad_param=>"foo"/, from_match
assert_match /:action=>"show"/, from_match
assert_match /:controller=>"post"/, from_match
assert_match(/:bad_param=>"foo"/, from_match)
assert_match(/:action=>"show"/, from_match)
assert_match(/:controller=>"post"/, from_match)
expected_match = exception.message.match(/expected: \{[^\}]+\}/).to_s
assert_no_match /:bad_param=>"foo"/, expected_match
assert_match /:action=>"show"/, expected_match
assert_match /:controller=>"post"/, expected_match
assert_no_match(/:bad_param=>"foo"/, expected_match)
assert_match( /:action=>"show"/, expected_match)
assert_match( /:controller=>"post"/, expected_match)
diff_match = exception.message.match(/diff: \{[^\}]+\}/).to_s
assert_match /:bad_param=>"foo"/, diff_match
assert_no_match /:action=>"show"/, diff_match
assert_no_match /:controller=>"post"/, diff_match
assert_match( /:bad_param=>"foo"/, diff_match)
assert_no_match(/:action=>"show"/, diff_match)
assert_no_match(/:controller=>"post"/, diff_match)
end
# this specifies the case where your formerly would get a very confusing error message with an empty diff