Sha256: b64eac63679a6bcf578032a6b9447b96d37f9f6899980416a04fc507e9f55d8c
Contents?: true
Size: 527 Bytes
Versions: 3
Compression:
Stored size: 527 Bytes
Contents
module BaconExpect; module Matcher class MatchArray def initialize(array) @array = array end def matches?(subject_array) return false unless subject_array.size == @array.size array_copy = subject_array.dup @array.all? do |item| has = array_copy.include?(item) array_copy.delete(item) if has has end end def fail!(subject_array) raise FailedExpectation.new("\"#{subject_array}\" expected to have same items as #{@array}") end end end; end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bacon-expect-1.0.2 | lib/bacon-expect/matchers/match_array.rb |
bacon-expect-1.0.1 | lib/bacon-expect/matchers/match_array.rb |
bacon-expect-0.1 | lib/bacon-expect/matchers/match_array.rb |