Created
May 1, 2010 10:21
-
-
Save heftig/386220 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit f1b805f1fcbc84784253f823ec1266f4c664f331 | |
Author: Jan Steffens <jan@silver.(none)> | |
Date: Fri Feb 5 05:06:31 2010 +0100 | |
Make compatible with Ruby 1.9.1 reduced unit/test implementation | |
diff --git a/koans/edgecase.rb b/koans/edgecase.rb | |
index acb032b..2aedde7 100644 | |
--- a/koans/edgecase.rb | |
+++ b/koans/edgecase.rb | |
@@ -30,7 +30,11 @@ module EdgeCase | |
class Sensei | |
attr_reader :failure, :failed_test | |
- AssertionError = Test::Unit::AssertionFailedError | |
+ if defined? MiniTest | |
+ AssertionError = MiniTest::Assertion | |
+ else | |
+ AssertionError = Test::Unit::AssertionFailedError | |
+ end | |
def initialize | |
@pass_count = 0 | |
@@ -77,7 +81,7 @@ module EdgeCase | |
def find_interesting_lines(backtrace) | |
backtrace.reject { |line| | |
- line =~ /test\/unit\/|edgecase\.rb/ | |
+ line =~ /minitest\/|test\/unit\/|edgecase\.rb/ | |
} | |
end | |
@@ -153,12 +157,12 @@ module EdgeCase | |
test.setup | |
begin | |
test.send(method) | |
- rescue StandardError => ex | |
+ rescue Exception => ex | |
test.failed(ex) | |
ensure | |
begin | |
test.teardown | |
- rescue StandardError => ex | |
+ rescue Exception => ex | |
test.failed(ex) if test.passed? | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment