Sha256: 9a839d49c4bcdde9c6cb26eefd9605e0933de48df08b5f645fb5b0315af112e0
Contents?: true
Size: 761 Bytes
Versions: 2
Compression:
Stored size: 761 Bytes
Contents
module SpecCombos # Mixin for the :and and :any collection matchers module CollectionMatcher def initialize(&item_matcher_proc) @item_matcher_proc = item_matcher_proc end def description "#{short_description} #{new_matcher.description}" end private def perform_matches(actual_items) actual_items.each_with_index.map do |item, index| matcher = new_matcher { index: index, item: item, matcher: matcher, match: matcher.matches?(item)} end end def new_matcher @item_matcher_proc.call end def failure_message_prefix(failure) "[#{failure[:index]}] (#{failure[:item]}): " end def actual_items @actual end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spec_combos-0.3.0 | lib/spec_combos/collection_matcher.rb |
spec_combos-0.2.0 | lib/spec_combos/collection_matcher.rb |