Class: Smartest::EqMatcher

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

Instance Method Summary collapse

Methods inherited from Matcher

#and, #or

Constructor Details

#initialize(expected) ⇒ EqMatcher

Returns a new instance of EqMatcher.



213
214
215
# File 'lib/smartest/matchers.rb', line 213

def initialize(expected)
  @expected = expected
end

Instance Method Details

#descriptionObject



230
231
232
# File 'lib/smartest/matchers.rb', line 230

def description
  "eq #{@expected.inspect}"
end

#failure_messageObject



222
223
224
# File 'lib/smartest/matchers.rb', line 222

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

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


217
218
219
220
# File 'lib/smartest/matchers.rb', line 217

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

#negated_failure_messageObject



226
227
228
# File 'lib/smartest/matchers.rb', line 226

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