Class: Smartest::EqMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/smartest/matchers.rb

Instance Method Summary collapse

Constructor Details

#initialize(expected) ⇒ EqMatcher

Returns a new instance of EqMatcher.



38
39
40
# File 'lib/smartest/matchers.rb', line 38

def initialize(expected)
  @expected = expected
end

Instance Method Details

#failure_messageObject



47
48
49
# File 'lib/smartest/matchers.rb', line 47

def failure_message
  "expected #{@actual.inspect} to eq #{@expected.inspect}"
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
45
# File 'lib/smartest/matchers.rb', line 42

def matches?(actual)
  @actual = actual
  actual == @expected
end

#negated_failure_messageObject



51
52
53
# File 'lib/smartest/matchers.rb', line 51

def negated_failure_message
  "expected #{@actual.inspect} not to eq #{@expected.inspect}"
end