Class: 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
Methods inherited from Matcher
Constructor Details
#initialize(*prefixes) ⇒ StartWithMatcher
Returns a new instance of StartWithMatcher.
261 262 263 |
# File 'lib/smartest/matchers.rb', line 261 def initialize(*prefixes) @prefixes = prefixes end |
Instance Method Details
#description ⇒ Object
280 281 282 |
# File 'lib/smartest/matchers.rb', line 280 def description "start with #{expected_description}" end |
#failure_message ⇒ Object
272 273 274 |
# File 'lib/smartest/matchers.rb', line 272 def "expected #{@actual.inspect} to start with #{expected_description}" end |
#matches?(actual) ⇒ Boolean
265 266 267 268 269 270 |
# File 'lib/smartest/matchers.rb', line 265 def matches?(actual) @actual = actual actual.start_with?(*@prefixes) rescue NoMethodError false end |
#negated_failure_message ⇒ Object
276 277 278 |
# File 'lib/smartest/matchers.rb', line 276 def "expected #{@actual.inspect} not to start with #{expected_description}" end |