Class: Smartest::StartWithMatcher
- Inherits:
-
Object
- Object
- Smartest::StartWithMatcher
- Defined in:
- lib/smartest/matchers.rb
Instance Method Summary collapse
- #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.
78 79 80 |
# File 'lib/smartest/matchers.rb', line 78 def initialize(*prefixes) @prefixes = prefixes end |
Instance Method Details
#failure_message ⇒ Object
89 90 91 |
# File 'lib/smartest/matchers.rb', line 89 def "expected #{@actual.inspect} to start with #{expected_description}" end |
#matches?(actual) ⇒ Boolean
82 83 84 85 86 87 |
# File 'lib/smartest/matchers.rb', line 82 def matches?(actual) @actual = actual actual.start_with?(*@prefixes) rescue NoMethodError false end |
#negated_failure_message ⇒ Object
93 94 95 |
# File 'lib/smartest/matchers.rb', line 93 def "expected #{@actual.inspect} not to start with #{expected_description}" end |