diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-12-19 08:47:06 -0200 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-12-19 08:47:09 -0200 |
commit | d799b9c1cf888a528d062cd44903cf2e0ce34a2c (patch) | |
tree | c8637c8790288f00846f452da2554ace84be7316 | |
parent | 813ab76788206ded84cb25e6cd3c259a399ba565 (diff) | |
download | rails-d799b9c1cf888a528d062cd44903cf2e0ce34a2c.tar.gz rails-d799b9c1cf888a528d062cd44903cf2e0ce34a2c.tar.bz2 rails-d799b9c1cf888a528d062cd44903cf2e0ce34a2c.zip |
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.
-rw-r--r-- | activesupport/test/dependencies_test.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb index e56bab6d4c..0380ea3c95 100644 --- a/activesupport/test/dependencies_test.rb +++ b/activesupport/test/dependencies_test.rb @@ -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 |