Class: Spec::Matchers::Match
- Defined in:
- lib/gems/rspec-1.1.11/lib/spec/matchers/match.rb
Overview
:nodoc:
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(regexp) ⇒ Match
constructor
A new instance of Match.
- #matches?(given) ⇒ Boolean
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(regexp) ⇒ Match
Returns a new instance of Match.
5 6 7 |
# File 'lib/gems/rspec-1.1.11/lib/spec/matchers/match.rb', line 5 def initialize(regexp) @regexp = regexp end |
Instance Method Details
#description ⇒ Object
23 24 25 |
# File 'lib/gems/rspec-1.1.11/lib/spec/matchers/match.rb', line 23 def description "match #{@regexp.inspect}" end |
#failure_message ⇒ Object
15 16 17 |
# File 'lib/gems/rspec-1.1.11/lib/spec/matchers/match.rb', line 15 def return "expected #{@given.inspect} to match #{@regexp.inspect}", @regexp, @given end |
#matches?(given) ⇒ Boolean
9 10 11 12 13 |
# File 'lib/gems/rspec-1.1.11/lib/spec/matchers/match.rb', line 9 def matches?(given) @given = given return true if given =~ @regexp return false end |
#negative_failure_message ⇒ Object
19 20 21 |
# File 'lib/gems/rspec-1.1.11/lib/spec/matchers/match.rb', line 19 def return "expected #{@given.inspect} not to match #{@regexp.inspect}", @regexp, @given end |