mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix asserting the correct exception message in dependencies test
In Minitest, the second argument of assert_raise(s) accepts a string as the message that should be shown in case of a failure in the assertion (eg nothing was raised when it should), and not the exception message to be matched. To do that we need to save the exception returned from assert_raise(s) into a local variable and check for the exception message using it.
This commit is contained in:
parent
813ab76788
commit
d799b9c1cf
1 changed files with 2 additions and 2 deletions
|
@ -543,8 +543,8 @@ class DependenciesTest < ActiveSupport::TestCase
|
|||
require_dependency 'e'
|
||||
|
||||
mod = Module.new
|
||||
msg = 'E cannot be autoloaded from an anonymous class or module'
|
||||
assert_raise(NameError, msg) { mod::E }
|
||||
e = assert_raise(NameError) { mod::E }
|
||||
assert_equal 'E cannot be autoloaded from an anonymous class or module', e.message
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue