diff options
author | Akira Matsuda <ronnie@dio.jp> | 2013-01-05 14:45:18 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2013-01-06 15:41:14 +0900 |
commit | 70ae89c321444eef42c0c011b522f926250e7acd (patch) | |
tree | 0f7abe41af87a17deb5c90465d1e9a190e4a70a9 /activesupport/test | |
parent | 3e8134a750bee5c4f7ede67f33263d36e4ff1474 (diff) | |
download | rails-70ae89c321444eef42c0c011b522f926250e7acd.tar.gz rails-70ae89c321444eef42c0c011b522f926250e7acd.tar.bz2 rails-70ae89c321444eef42c0c011b522f926250e7acd.zip |
Remove unnecessary begin..rescue..end, use only rescue
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/duration_test.rb | 14 | ||||
-rw-r--r-- | activesupport/test/dependencies_test.rb | 10 |
2 files changed, 10 insertions, 14 deletions
diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb index 2826f51f2d..5e3987265b 100644 --- a/activesupport/test/core_ext/duration_test.rb +++ b/activesupport/test/core_ext/duration_test.rb @@ -50,14 +50,12 @@ class DurationTest < ActiveSupport::TestCase end def test_argument_error - begin - 1.second.ago('') - flunk("no exception was raised") - rescue ArgumentError => e - assert_equal 'expected a time or date, got ""', e.message, "ensure ArgumentError is not being raised by dependencies.rb" - rescue Exception => e - flunk("ArgumentError should be raised, but we got #{e.class} instead") - end + 1.second.ago('') + flunk("no exception was raised") + rescue ArgumentError => e + assert_equal 'expected a time or date, got ""', e.message, "ensure ArgumentError is not being raised by dependencies.rb" + rescue Exception => e + flunk("ArgumentError should be raised, but we got #{e.class} instead") end def test_fractional_weeks diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb index 9d913c27b0..615808090d 100644 --- a/activesupport/test/dependencies_test.rb +++ b/activesupport/test/dependencies_test.rb @@ -363,12 +363,10 @@ class DependenciesTest < ActiveSupport::TestCase end def test_smart_name_error_strings - begin - Object.module_eval "ImaginaryObject" - flunk "No raise!!" - rescue NameError => e - assert e.message.include?("uninitialized constant ImaginaryObject") - end + Object.module_eval "ImaginaryObject" + flunk "No raise!!" + rescue NameError => e + assert e.message.include?("uninitialized constant ImaginaryObject") end def test_loadable_constants_for_path_should_handle_empty_autoloads |