Class: Matchy::Expectations::RespondToExpectation

Inherits:
Base
  • Object
show all
Defined in:
lib/matchy/built_in/truth_expectations.rb

Instance Method Summary collapse

Methods inherited from Base

#fail!, #initialize, #pass!

Constructor Details

This class inherits a constructor from Matchy::Expectations::Base

Instance Method Details

#failure_messageObject



126
127
128
# File 'lib/matchy/built_in/truth_expectations.rb', line 126

def failure_message
  "Expected #{@receiver.inspect} to respond to #{@expected.inspect}."
end

#matches?(receiver) ⇒ Boolean

Returns:

  • (Boolean)


121
122
123
124
# File 'lib/matchy/built_in/truth_expectations.rb', line 121

def matches?(receiver)
  @receiver = receiver
  @receiver.respond_to?(@expected)
end

#negative_failure_messageObject



130
131
132
# File 'lib/matchy/built_in/truth_expectations.rb', line 130

def negative_failure_message
  "Expected #{@receiver.inspect} to not respond to #{@expected.inspect}."
end