Class: Crspec::Matchers::IncludeMatcher
Instance Attribute Summary
Attributes inherited from BaseMatcher
#actual, #expected
Instance Method Summary
collapse
Methods inherited from BaseMatcher
#initialize
Instance Method Details
#failure_message ⇒ Object
100
101
102
|
# File 'lib/crspec/matchers.rb', line 100
def failure_message
"Expected #{@actual.inspect} to include #{@expected.inspect}"
end
|
#failure_message_when_negated ⇒ Object
104
105
106
|
# File 'lib/crspec/matchers.rb', line 104
def failure_message_when_negated
"Expected #{@actual.inspect} not to include #{@expected.inspect}"
end
|
#matches?(actual) ⇒ Boolean
91
92
93
94
95
96
97
98
|
# File 'lib/crspec/matchers.rb', line 91
def matches?(actual)
@actual = actual
if @expected.is_a?(Array)
@expected.all? { |e| @actual.include?(e) }
else
@actual.include?(@expected)
end
end
|