Class: Smartest::EndWithMatcher
- Inherits:
-
Object
- Object
- Smartest::EndWithMatcher
- Defined in:
- lib/smartest/matchers.rb
Instance Method Summary collapse
- #failure_message ⇒ Object
-
#initialize(*suffixes) ⇒ EndWithMatcher
constructor
A new instance of EndWithMatcher.
- #matches?(actual) ⇒ Boolean
- #negated_failure_message ⇒ Object
Constructor Details
#initialize(*suffixes) ⇒ EndWithMatcher
Returns a new instance of EndWithMatcher.
107 108 109 |
# File 'lib/smartest/matchers.rb', line 107 def initialize(*suffixes) @suffixes = suffixes end |
Instance Method Details
#failure_message ⇒ Object
118 119 120 |
# File 'lib/smartest/matchers.rb', line 118 def "expected #{@actual.inspect} to end with #{expected_description}" end |
#matches?(actual) ⇒ Boolean
111 112 113 114 115 116 |
# File 'lib/smartest/matchers.rb', line 111 def matches?(actual) @actual = actual actual.end_with?(*@suffixes) rescue NoMethodError false end |
#negated_failure_message ⇒ Object
122 123 124 |
# File 'lib/smartest/matchers.rb', line 122 def "expected #{@actual.inspect} not to end with #{expected_description}" end |