module Assertions

TODO: Randomize tests across classes/methods

Create more assertions based on testing needs
Use 'test "some test description here" do/assert/end' format

Public Instance Methods

assert(test, msg = "Failed test") click to toggle source
# File lib/moomootest.rb, line 10
def assert test, msg = "Failed test"
  unless test then
    bt = caller.drop_while { |s| s =~ /#{__FILE__}/ }
    raise RuntimeError, msg, bt
  end
end
assert_equal(a, b) click to toggle source
# File lib/moomootest.rb, line 17
def assert_equal a, b
  assert a == b, "Failed assert_equal #{a} vs #{b}"
end
assert_in_delta(a, b) click to toggle source
# File lib/moomootest.rb, line 21
def assert_in_delta a, b
  assert (a-b).abs <= 0.001, "Failed assert_in_delta #{a} vs #{b}"
end
test(name="untitled") { || ... } click to toggle source
# File lib/moomootest.rb, line 6
def test name="untitled"
  yield
end