Class: SpecCombos::AndMatcher
- Inherits:
-
Object
- Object
- SpecCombos::AndMatcher
- Includes:
- MatcherCombiner, MatcherCombiner::And
- Defined in:
- lib/spec_combos/and_matcher.rb
Overview
Matcher to verify that an item matches all matchers in a list
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(*matchers) ⇒ AndMatcher
constructor
A new instance of AndMatcher.
Methods included from MatcherCombiner::And
Methods included from MatcherCombiner
#failure_message_for_should, #failure_message_for_should_not, #matches?
Constructor Details
#initialize(*matchers) ⇒ AndMatcher
Returns a new instance of AndMatcher.
8 9 10 |
# File 'lib/spec_combos/and_matcher.rb', line 8 def initialize(*matchers) @matchers = matchers end |
Instance Method Details
#description ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/spec_combos/and_matcher.rb', line 12 def description descriptions = @matchers.map &:description if descriptions.size <= 2 descriptions.join(" and ") else descriptions[0..-2].join(", ") + " and " + descriptions.last end end |