Skip to content

Instantly share code, notes, and snippets.

@hakobe
Created September 26, 2008 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hakobe/13072 to your computer and use it in GitHub Desktop.
Save hakobe/13072 to your computer and use it in GitHub Desktop.
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