Class: Crspec::Matchers::IncludeMatcher
Instance Attribute Summary
Attributes inherited from BaseMatcher
#actual, #expected
Instance Method Summary
collapse
Methods inherited from BaseMatcher
#and, #initialize, #or
Instance Method Details
#failure_message ⇒ Object
180
181
182
|
# File 'lib/crspec/matchers.rb', line 180
def failure_message
"Expected #{@actual.inspect} to include #{@expected.inspect}"
end
|
#failure_message_when_negated ⇒ Object
184
185
186
|
# File 'lib/crspec/matchers.rb', line 184
def failure_message_when_negated
"Expected #{@actual.inspect} not to include #{@expected.inspect}"
end
|
#matches?(actual) ⇒ Boolean
171
172
173
174
175
176
177
178
|
# File 'lib/crspec/matchers.rb', line 171
def matches?(actual)
@actual = actual
if @expected.is_a?(Array)
@expected.all? { |e| @actual.include?(e) }
else
@actual.include?(@expected)
end
end
|