lib/assay/assertions/same_failure.rb in assay-0.2.0 vs lib/assay/assertions/same_failure.rb in assay-0.3.0
- old
+ new
@@ -18,10 +18,11 @@
exp.eql?(act)
end
#
def to_s
+ return @mesg if @mesg
return super unless @arguments.size == 2
exp = @arguments[0].inspect
act = @arguments[1].inspect
@@ -42,21 +43,19 @@
# since a helpful error message is generated when this
# one fails that tells you the values of expected and actual.
#
# assert_same 'MY STRING', 'my string'.upcase
#
- def assert_same(exp, act, opts={})
- opts[:backtrace] ||= caller
- SameFailure.assert(exp, act, opts)
+ def assert_same(exp, act, msg=nil)
+ SameFailure.assert(exp, act, :message=>msg, :backtrace=>caller)
end
# Passes if not +expected+ .eq? +actual+.
#
# assert_not_the_same 'some string', 5
#
- def refute_same(exp, act, opts={})
- opts[:backtrace] ||= caller
- SameFailure.refute(exp, act, opts)
+ def refute_same(exp, act, msg=nil)
+ SameFailure.refute(exp, act, :message=>msg, :backtrace=>caller)
end
alias_method :assert_not_same, :refute_same
end