diff options
author | Alexey Zapparov <ixti@member.fsf.org> | 2016-05-23 22:45:01 +0200 |
---|---|---|
committer | Rafael França <rafaelmfranca@gmail.com> | 2016-05-23 17:45:01 -0300 |
commit | 28492204ee59a5aca2f3bc7b161d45724552686d (patch) | |
tree | 7561aa4324bf2fa543ab7459bad6c18651e025e4 /activesupport/test/core_ext | |
parent | d0a23339acb05358154c50655ec0c6e70e0af7f8 (diff) | |
download | rails-28492204ee59a5aca2f3bc7b161d45724552686d.tar.gz rails-28492204ee59a5aca2f3bc7b161d45724552686d.tar.bz2 rails-28492204ee59a5aca2f3bc7b161d45724552686d.zip |
Add default exceptions affected by suppress (#25099)
* Add default exceptions affected by suppress
suppress { do_something_that_might_fail }
# instead of
begin
do_something_that_might_fail
rescue
end
# or
do_something_that_might_fail rescue nil
* Do not add default exceptions list constant
[Rafael Mendonça França + Alexey Zapparov]
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r-- | activesupport/test/core_ext/kernel_test.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/kernel_test.rb b/activesupport/test/core_ext/kernel_test.rb index 503e6595cb..bb634d6a09 100644 --- a/activesupport/test/core_ext/kernel_test.rb +++ b/activesupport/test/core_ext/kernel_test.rb @@ -42,6 +42,15 @@ class KernelSuppressTest < ActiveSupport::TestCase end end + def test_suppress_with_defaults + suppress { raise RuntimeError } + suppress { raise ArgumentError } + + assert_raise(LoadError) do + suppress { raise LoadError } + end + end + def test_suppression suppress(ArgumentError) { raise ArgumentError } suppress(LoadError) { raise LoadError } |