Class: Ramcrest::MatcherMatcher::MatcherDescribedAsMatcher
- Inherits:
-
Object
- Object
- Ramcrest::MatcherMatcher::MatcherDescribedAsMatcher
- Includes:
- Ramcrest::Matcher
- Defined in:
- lib/ramcrest/matcher_matcher.rb
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(description) ⇒ MatcherDescribedAsMatcher
constructor
A new instance of MatcherDescribedAsMatcher.
- #matches?(matcher) ⇒ Boolean
Methods included from Ramcrest::Matcher
#do_match, #mismatch, #success
Constructor Details
#initialize(description) ⇒ MatcherDescribedAsMatcher
Returns a new instance of MatcherDescribedAsMatcher.
42 43 44 |
# File 'lib/ramcrest/matcher_matcher.rb', line 42 def initialize(description) @description = description end |
Instance Method Details
#description ⇒ Object
54 55 56 |
# File 'lib/ramcrest/matcher_matcher.rb', line 54 def description "a matcher described as \"#{@description}\"" end |
#matches?(matcher) ⇒ Boolean
46 47 48 49 50 51 52 |
# File 'lib/ramcrest/matcher_matcher.rb', line 46 def matches?(matcher) if matcher.description == @description success else mismatch("a matcher that described itself as \"#{matcher.description}\"") end end |