When searching for test failure, accept either MiniTest::Assertion or Test::Unit::AssertionFailedError for Ruby 1.9 compatibility.
This commit is contained in:
parent
f062a6924e
commit
13ff067422
|
@ -13,7 +13,12 @@ module Shoulda
|
|||
# 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
|
||||
|
|
Loading…
Reference in New Issue