Class: MotionSpec::Matcher::EndWith
- Defined in:
- lib/motion-spec/matcher/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.
5 6 7 |
# File 'lib/motion-spec/matcher/end_with.rb', line 5 def initialize(end_string) @end_string = end_string end |
Instance Method Details
#fail!(subject, negated) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/motion-spec/matcher/end_with.rb', line 13 def fail!(subject, negated) fail FailedExpectation.new( FailMessageRenderer.( negated, subject, @end_string ) ) end |
#matches?(subject) ⇒ Boolean
9 10 11 |
# File 'lib/motion-spec/matcher/end_with.rb', line 9 def matches?(subject) subject[-@end_string.size..-1] == @end_string end |