Permalink
Browse files

When searching for test failure, accept either MiniTest::Assertion or…

… Test::Unit::AssertionFailedError for Ruby 1.9 compatibility.
  • Loading branch information...
1 parent f062a69 commit 13ff067422765a5e113da6e0188b4fc9ca9dccfb Dean Strelau committed Jun 3, 2009
Showing with 6 additions and 1 deletion.
  1. +6 −1 test/fail_macros.rb
View
@@ -13,7 +13,12 @@ module ClassMethods
# end
def should_fail(&block)
context "should fail when trying to run:" do
- Shoulda.expected_exceptions = [Test::Unit::AssertionFailedError]
+ if defined?(Test::Unit::AssertionFailedError)
+ failures = [Test::Unit::AssertionFailedError]
+ elsif defined?(MiniTest::Assertion)
+ failures = [MiniTest::Assertion]
+ end
+ Shoulda.expected_exceptions = failures
yield block
Shoulda.expected_exceptions = nil
end

0 comments on commit 13ff067

Please sign in to comment.