Commit 821f6d42 authored by Daniel Bovensiepen's avatar Daniel Bovensiepen

Add block mode to assert_equal

parent 34cd70b1
......@@ -99,7 +99,16 @@ def assert_false(ret, msg = nil, diff = nil)
!ret
end
def assert_equal(exp, act, msg = nil)
def assert_equal(arg1, arg2 = nil, arg3 = nil)
if block_given?
exp = yield
act = arg1
msg = arg2
else
exp = arg1
act = arg2
msg = arg3
end
msg = "Expected to be equal" unless msg
diff = assertion_diff(exp, act)
assert_true(exp == act, msg, diff)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment