Class: Ramcrest::MatcherMatcher::MatcherThatMatchesMatcher
- Inherits:
-
Object
- Object
- Ramcrest::MatcherMatcher::MatcherThatMatchesMatcher
- Includes:
- Ramcrest::Matcher
- Defined in:
- lib/ramcrest/matcher_matcher.rb
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(value) ⇒ MatcherThatMatchesMatcher
constructor
A new instance of MatcherThatMatchesMatcher.
- #matches?(matcher) ⇒ Boolean
Methods included from Ramcrest::Matcher
#do_match, #mismatch, #success
Constructor Details
#initialize(value) ⇒ MatcherThatMatchesMatcher
Returns a new instance of MatcherThatMatchesMatcher.
21 22 23 |
# File 'lib/ramcrest/matcher_matcher.rb', line 21 def initialize(value) @value = value end |
Instance Method Details
#description ⇒ Object
34 35 36 |
# File 'lib/ramcrest/matcher_matcher.rb', line 34 def description "a matcher that matches <#{@value}>" end |
#matches?(matcher) ⇒ Boolean
25 26 27 28 29 30 31 32 |
# File 'lib/ramcrest/matcher_matcher.rb', line 25 def matches?(matcher) match = matcher.matches?(@value) if match.matched? success else mismatch("a matcher describing itself as <#{matcher.description}> that mismatched with <#{match.description}>") end end |