Sha256: f05b3b8ee9098e432ed7eacdcaf0aa1895424ca9d9fcc931c14faca5bad74e87
Contents?: true
Size: 1.45 KB
Versions: 2
Compression:
Stored size: 1.45 KB
Contents
module OpalSpec class Matcher attr_reader :actual, :expected def initialize expected = nil @expected = expected end def positive_match? actual @actual = actual unless match expected, actual raise OpalSpec::ExpectationNotMetError, failure_message_for_should end end def negative_match? actual @actual = actual if match expected, actual raise OpalSpec::ExpectationNotMetError, failure_message_for_should_not end end def failure_message_for_should "expected: #{expected.inspect}, actual: #{actual.inspect} (#{matcher_name}) [should]." end def failure_message_for_should_not "expected: #{expected.inspect}, actual: #{actual.inspect} (#{matcher_name}) [should_not]." end end class PositiveOperatorMatcher < Matcher def == actual @actual = actual unless expected == actual raise Opal::Spec::ExpectationNotMetError, failure_message_for_should end end def failure_message_for_should "expected #{actual.inspect}, but got: #{expected.inspect} (using ==)." end end class NegativeOperatorMatcher < Matcher def == actual @actual = actual if expected == actual raise Opal::Spec::ExpectationNotMetError, failure_message_for_should_not end end def failure_message_for_should_not "expected #{actual.inspect} not to be: #{expected.inspect} (using ==)." end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
opal-spec-0.3.2 | opal/opal/spec/matchers.rb |
opal-spec-0.3.1 | opal/opal/spec/matchers.rb |