Created
September 26, 2008 08:59
-
-
Save hakobe/13072 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
require 'test/unit' | |
module Test::Unit::Assertions | |
def assert_or(*asserts) | |
asserts.each do |a| | |
a[] rescue next | |
return | |
end | |
raise Test::Unit::AssertionFailedError | |
end | |
end | |
class Test::AssertOr < Test::Unit::TestCase | |
def test_assert_or | |
assert_nothing_raised { | |
assert_or( proc { assert(true) }, proc { assert(true) }) | |
} | |
assert_nothing_raised { | |
assert_or( proc { assert(true) }, proc { assert(false) }) | |
} | |
assert_nothing_raised { | |
assert_or( proc { assert(false) }, proc { assert(true) }) | |
} | |
assert_raise (Test::Unit::AssertionFailedError){ | |
assert_or( proc { assert(false) }, proc { assert(false) }) | |
} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment