mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Silence warning: ambiguous first argument; put parentheses or even spaces
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user