Class: Smartest::StartWithMatcher
- Inherits:
-
Object
- Object
- Smartest::StartWithMatcher
- Defined in:
- lib/smartest/matchers.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(*prefixes) ⇒ StartWithMatcher
constructor
A new instance of StartWithMatcher.
- #matches?(actual) ⇒ Boolean
- #negated_failure_message ⇒ Object
Constructor Details
#initialize(*prefixes) ⇒ StartWithMatcher
Returns a new instance of StartWithMatcher.
106 107 108 |
# File 'lib/smartest/matchers.rb', line 106 def initialize(*prefixes) @prefixes = prefixes end |
Instance Method Details
#description ⇒ Object
125 126 127 |
# File 'lib/smartest/matchers.rb', line 125 def description "start with #{expected_description}" end |
#failure_message ⇒ Object
117 118 119 |
# File 'lib/smartest/matchers.rb', line 117 def "expected #{@actual.inspect} to start with #{expected_description}" end |
#matches?(actual) ⇒ Boolean
110 111 112 113 114 115 |
# File 'lib/smartest/matchers.rb', line 110 def matches?(actual) @actual = actual actual.start_with?(*@prefixes) rescue NoMethodError false end |
#negated_failure_message ⇒ Object
121 122 123 |
# File 'lib/smartest/matchers.rb', line 121 def "expected #{@actual.inspect} not to start with #{expected_description}" end |