diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-05-19 11:16:21 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-05-19 11:16:21 -0700 |
commit | 2b6bec5cdd84c4ba65cbe99ae48697d977ae9491 (patch) | |
tree | 62c8cdb5724af18da50f1abc3fac431152807fc2 /activesupport/lib/active_support/testing/setup_and_teardown.rb | |
parent | e6f5079a48094eeba3dab9dca52b16b58ddc3634 (diff) | |
download | rails-2b6bec5cdd84c4ba65cbe99ae48697d977ae9491.tar.gz rails-2b6bec5cdd84c4ba65cbe99ae48697d977ae9491.tar.bz2 rails-2b6bec5cdd84c4ba65cbe99ae48697d977ae9491.zip |
Workaround missing Test::Unit::TestCase::PASSTHROUGH_EXCEPTIONS in Ruby < 1.8.6. [#224 state:resolved]
Diffstat (limited to 'activesupport/lib/active_support/testing/setup_and_teardown.rb')
-rw-r--r-- | activesupport/lib/active_support/testing/setup_and_teardown.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/testing/setup_and_teardown.rb b/activesupport/lib/active_support/testing/setup_and_teardown.rb index b2a937edd0..ed8e34510a 100644 --- a/activesupport/lib/active_support/testing/setup_and_teardown.rb +++ b/activesupport/lib/active_support/testing/setup_and_teardown.rb @@ -1,6 +1,14 @@ module ActiveSupport module Testing module SetupAndTeardown + # For compatibility with Ruby < 1.8.6 + PASSTHROUGH_EXCEPTIONS = + if defined?(Test::Unit::TestCase::PASSTHROUGH_EXCEPTIONS) + Test::Unit::TestCase::PASSTHROUGH_EXCEPTIONS + else + [NoMemoryError, SignalException, Interrupt, SystemExit] + end + def self.included(base) base.send :include, ActiveSupport::Callbacks base.define_callbacks :setup, :teardown @@ -25,7 +33,7 @@ module ActiveSupport __send__(@method_name) rescue Test::Unit::AssertionFailedError => e add_failure(e.message, e.backtrace) - rescue *Test::Unit::TestCase::PASSTHROUGH_EXCEPTIONS + rescue *PASSTHROUGH_EXCEPTIONS raise rescue Exception add_error($!) @@ -35,7 +43,7 @@ module ActiveSupport run_callbacks :teardown, :enumerator => :reverse_each rescue Test::Unit::AssertionFailedError => e add_failure(e.message, e.backtrace) - rescue *Test::Unit::TestCase::PASSTHROUGH_EXCEPTIONS + rescue *PASSTHROUGH_EXCEPTIONS raise rescue Exception add_error($!) |