Class: Crspec::Matchers::RespondToMatcher
Instance Attribute Summary
Attributes inherited from BaseMatcher
#actual, #expected
Instance Method Summary
collapse
Methods inherited from BaseMatcher
#failure_message_when_negated
Constructor Details
Returns a new instance of RespondToMatcher.
156
157
158
159
|
# File 'lib/crspec/matchers.rb', line 156
def initialize(*methods)
super(methods)
@methods = methods
end
|
Instance Method Details
#failure_message ⇒ Object
166
167
168
|
# File 'lib/crspec/matchers.rb', line 166
def failure_message
"Expected #{@actual.inspect} to respond to #{@methods.map(&:inspect).join(", ")}"
end
|
#matches?(actual) ⇒ Boolean
161
162
163
164
|
# File 'lib/crspec/matchers.rb', line 161
def matches?(actual)
@actual = actual
@methods.all? { |m| @actual.respond_to?(m) }
end
|