diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2016-08-27 01:08:43 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-27 01:08:43 -0500 |
commit | 29f097c53876411a6d468060de318814c9b89291 (patch) | |
tree | bc9a65d54b950a93a474fb15d307a167cec0990c | |
parent | 1ec85cf9d8a6ad36c3c40cc08a0c7d8407e4b080 (diff) | |
parent | 3cece0b6574c496605df055a2ebf77177f5b6e7f (diff) | |
download | rails-29f097c53876411a6d468060de318814c9b89291.tar.gz rails-29f097c53876411a6d468060de318814c9b89291.tar.bz2 rails-29f097c53876411a6d468060de318814c9b89291.zip |
Merge pull request #26293 from mechanicles/move-custom-assertion
Move Rails' custom assertion method `assert_nothing_raised` to its proper place.
-rw-r--r-- | activesupport/lib/active_support/test_case.rb | 11 | ||||
-rw-r--r-- | activesupport/lib/active_support/testing/assertions.rb | 11 |
2 files changed, 11 insertions, 11 deletions
diff --git a/activesupport/lib/active_support/test_case.rb b/activesupport/lib/active_support/test_case.rb index a8e98b704a..1c599b8851 100644 --- a/activesupport/lib/active_support/test_case.rb +++ b/activesupport/lib/active_support/test_case.rb @@ -65,16 +65,5 @@ module ActiveSupport alias :assert_not_predicate :refute_predicate alias :assert_not_respond_to :refute_respond_to alias :assert_not_same :refute_same - - # Assertion that the block should not raise an exception. - # - # Passes if evaluated code in the yielded block raises no exception. - # - # assert_nothing_raised do - # perform_service(param: 'no_exception') - # end - def assert_nothing_raised - yield - end end end diff --git a/activesupport/lib/active_support/testing/assertions.rb b/activesupport/lib/active_support/testing/assertions.rb index 7770aa8006..6a6941c72a 100644 --- a/activesupport/lib/active_support/testing/assertions.rb +++ b/activesupport/lib/active_support/testing/assertions.rb @@ -19,6 +19,17 @@ module ActiveSupport assert !object, message end + # Assertion that the block should not raise an exception. + # + # Passes if evaluated code in the yielded block raises no exception. + # + # assert_nothing_raised do + # perform_service(param: 'no_exception') + # end + def assert_nothing_raised + yield + end + # Test numeric difference between the return value of an expression as a # result of what is evaluated in the yielded block. # |