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.



58
59
60
# File 'lib/smartest/matchers.rb', line 58

def initialize(expected)
  @expected = expected
end

Instance Method Details

#descriptionObject



75
76
77
# File 'lib/smartest/matchers.rb', line 75

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

#failure_messageObject



67
68
69
# File 'lib/smartest/matchers.rb', line 67

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

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


62
63
64
65
# File 'lib/smartest/matchers.rb', line 62

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

#negated_failure_messageObject



71
72
73
# File 'lib/smartest/matchers.rb', line 71

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