Class: Crspec::Matchers::StartWithMatcher
- Inherits:
-
BaseMatcher
- Object
- BaseMatcher
- Crspec::Matchers::StartWithMatcher
- Defined in:
- lib/crspec/matchers.rb
Instance Attribute Summary
Attributes inherited from BaseMatcher
Instance Method Summary collapse
Methods inherited from BaseMatcher
#and, #failure_message_when_negated, #initialize, #or
Constructor Details
This class inherits a constructor from Crspec::Matchers::BaseMatcher
Instance Method Details
#failure_message ⇒ Object
563 564 565 |
# File 'lib/crspec/matchers.rb', line 563 def "Expected #{@actual.inspect} to start with #{@expected.inspect}" end |
#matches?(actual) ⇒ Boolean
552 553 554 555 556 557 558 559 560 561 |
# File 'lib/crspec/matchers.rb', line 552 def matches?(actual) @actual = actual if actual.respond_to?(:start_with?) actual.start_with?(@expected) elsif actual.is_a?(Array) actual.first(Array(@expected).size) == Array(@expected) else false end end |