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