Class: Smartest::EndWithMatcher
- Inherits:
-
Object
- Object
- Smartest::EndWithMatcher
- Defined in:
- lib/smartest/matchers.rb
Instance Method Summary collapse
- #description ⇒ Object
- #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.
139 140 141 |
# File 'lib/smartest/matchers.rb', line 139 def initialize(*suffixes) @suffixes = suffixes end |
Instance Method Details
#description ⇒ Object
158 159 160 |
# File 'lib/smartest/matchers.rb', line 158 def description "end with #{expected_description}" end |
#failure_message ⇒ Object
150 151 152 |
# File 'lib/smartest/matchers.rb', line 150 def "expected #{@actual.inspect} to end with #{expected_description}" end |
#matches?(actual) ⇒ Boolean
143 144 145 146 147 148 |
# File 'lib/smartest/matchers.rb', line 143 def matches?(actual) @actual = actual actual.end_with?(*@suffixes) rescue NoMethodError false end |
#negated_failure_message ⇒ Object
154 155 156 |
# File 'lib/smartest/matchers.rb', line 154 def "expected #{@actual.inspect} not to end with #{expected_description}" end |