diff options
author | Mikel Lindsaar <raasdnil@gmail.com> | 2009-11-24 21:45:14 +1100 |
---|---|---|
committer | Mikel Lindsaar <raasdnil@gmail.com> | 2009-11-24 21:45:14 +1100 |
commit | 5f2395041d1578433fa825ed5c6f26a201f2203d (patch) | |
tree | 3b78531ae77a2173ad0df1103543bdfea0b1f60f /activesupport/lib/active_support/testing | |
parent | 3a72923e27195983d37bdb39ef26b29cf03d3483 (diff) | |
parent | e62e6d409986cd5c99234689aa49e3162d7b3a59 (diff) | |
download | rails-5f2395041d1578433fa825ed5c6f26a201f2203d.tar.gz rails-5f2395041d1578433fa825ed5c6f26a201f2203d.tar.bz2 rails-5f2395041d1578433fa825ed5c6f26a201f2203d.zip |
Merge branch 'master' of git://github.com/rails/rails into rails_master
Diffstat (limited to 'activesupport/lib/active_support/testing')
-rw-r--r-- | activesupport/lib/active_support/testing/isolation.rb | 15 | ||||
-rw-r--r-- | activesupport/lib/active_support/testing/setup_and_teardown.rb | 4 |
2 files changed, 17 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/testing/isolation.rb b/activesupport/lib/active_support/testing/isolation.rb index c75b59c284..81f7e3c9df 100644 --- a/activesupport/lib/active_support/testing/isolation.rb +++ b/activesupport/lib/active_support/testing/isolation.rb @@ -1,10 +1,25 @@ module ActiveSupport module Testing + class RemoteError < StandardError + + attr_reader :message, :backtrace + + def initialize(exception) + @message = "caught #{exception.class.name}: #{exception.message}" + @backtrace = exception.backtrace + end + end + class ProxyTestResult def initialize @calls = [] end + def add_error(e) + e = Test::Unit::Error.new(e.test_name, RemoteError.new(e.exception)) + @calls << [:add_error, e] + end + def __replay__(result) @calls.each do |name, args| result.send(name, *args) diff --git a/activesupport/lib/active_support/testing/setup_and_teardown.rb b/activesupport/lib/active_support/testing/setup_and_teardown.rb index 7952eb50c3..0e998d2dbe 100644 --- a/activesupport/lib/active_support/testing/setup_and_teardown.rb +++ b/activesupport/lib/active_support/testing/setup_and_teardown.rb @@ -21,12 +21,12 @@ module ActiveSupport run_callbacks :setup result = super rescue Exception => e - result = runner.puke(self.class, self.name, e) + result = runner.puke(self.class, method_name, e) ensure begin run_callbacks :teardown, :enumerator => :reverse_each rescue Exception => e - result = runner.puke(self.class, self.name, e) + result = runner.puke(self.class, method_name, e) end end result |