Class: BaconExpect::Matcher::EndWith
- Inherits:
-
Object
- Object
- BaconExpect::Matcher::EndWith
- Defined in:
- lib/bacon-expect/matchers/end_with.rb
Instance Method Summary collapse
- #fail!(subject, negated) ⇒ Object
-
#initialize(end_string) ⇒ EndWith
constructor
A new instance of EndWith.
- #matches?(subject) ⇒ Boolean
Constructor Details
#initialize(end_string) ⇒ EndWith
Returns a new instance of EndWith.
3 4 5 |
# File 'lib/bacon-expect/matchers/end_with.rb', line 3 def initialize(end_string) @end_string = end_string end |
Instance Method Details
#fail!(subject, negated) ⇒ Object
11 12 13 |
# File 'lib/bacon-expect/matchers/end_with.rb', line 11 def fail!(subject, negated) raise FailedExpectation.new(FailMessageRenderer.(negated, subject, @end_string)) end |
#matches?(subject) ⇒ Boolean
7 8 9 |
# File 'lib/bacon-expect/matchers/end_with.rb', line 7 def matches?(subject) subject[-@end_string.size..-1] == @end_string end |