Class: 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
Methods inherited from Matcher
Constructor Details
#initialize(*suffixes) ⇒ EndWithMatcher
Returns a new instance of EndWithMatcher.
294 295 296 |
# File 'lib/smartest/matchers.rb', line 294 def initialize(*suffixes) @suffixes = suffixes end |
Instance Method Details
#description ⇒ Object
313 314 315 |
# File 'lib/smartest/matchers.rb', line 313 def description "end with #{expected_description}" end |
#failure_message ⇒ Object
305 306 307 |
# File 'lib/smartest/matchers.rb', line 305 def "expected #{@actual.inspect} to end with #{expected_description}" end |
#matches?(actual) ⇒ Boolean
298 299 300 301 302 303 |
# File 'lib/smartest/matchers.rb', line 298 def matches?(actual) @actual = actual actual.end_with?(*@suffixes) rescue NoMethodError false end |
#negated_failure_message ⇒ Object
309 310 311 |
# File 'lib/smartest/matchers.rb', line 309 def "expected #{@actual.inspect} not to end with #{expected_description}" end |