Class: Spec::Matchers::Match
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message_for_should ⇒ Object
- #failure_message_for_should_not ⇒ Object
-
#initialize(expected) ⇒ Match
constructor
A new instance of Match.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize(expected) ⇒ Match
Returns a new instance of Match.
4 5 6 |
# File 'lib/spec/matchers/match.rb', line 4 def initialize(expected) @expected = expected end |
Instance Method Details
#description ⇒ Object
21 22 23 |
# File 'lib/spec/matchers/match.rb', line 21 def description "match #{@expected.inspect}" end |
#failure_message_for_should ⇒ Object
13 14 15 |
# File 'lib/spec/matchers/match.rb', line 13 def return "expected #{@actual.inspect} to match #{@expected.inspect}", @expected, @actual end |
#failure_message_for_should_not ⇒ Object
17 18 19 |
# File 'lib/spec/matchers/match.rb', line 17 def return "expected #{@actual.inspect} not to match #{@expected.inspect}", @expected, @actual end |
#matches?(actual) ⇒ Boolean
8 9 10 11 |
# File 'lib/spec/matchers/match.rb', line 8 def matches?(actual) @actual = actual actual =~ @expected end |