Class: MotionSpec::Matcher::StartWith
- Defined in:
- lib/motion-spec/matcher/start_with.rb
Instance Method Summary collapse
- #fail!(subject, negated) ⇒ Object
-
#initialize(start_string) ⇒ StartWith
constructor
A new instance of StartWith.
- #matches?(subject) ⇒ Boolean
Constructor Details
#initialize(start_string) ⇒ StartWith
Returns a new instance of StartWith.
5 6 7 |
# File 'lib/motion-spec/matcher/start_with.rb', line 5 def initialize(start_string) @start_string = start_string end |
Instance Method Details
#fail!(subject, negated) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/motion-spec/matcher/start_with.rb', line 13 def fail!(subject, negated) raise FailedExpectation.new( FailMessageRenderer.( negated, subject, @start_string ) ) end |
#matches?(subject) ⇒ Boolean
9 10 11 |
# File 'lib/motion-spec/matcher/start_with.rb', line 9 def matches?(subject) subject[0...@start_string.size] == @start_string end |