lib/opal-spec/matchers.rb in opal-spec-0.2.5 vs lib/opal-spec/matchers.rb in opal-spec-0.2.6

- old
+ new

@@ -57,9 +57,23 @@ failure "expected #{expected.inspect} to be false." end end end + class EqlMatcher < Matcher + def match(expected) + unless expected == @actual + failure "expected: #{expected.inspect}, got: #{@actual.inspect} (using ==)." + end + end + + def not_match(expected) + if expected.equal? @actual + failure "expected: #{expected.inspect} not to be #{@actual.inspect} (using ==)." + end + end + end + class EqualMatcher < Matcher def match expected unless expected.equal? @actual failure "expected #{@actual.inspect} to be the same as #{expected.inspect}." end