Sha256: bc91543012d019c003bfba2031a9d67cb388ebb558a4bf111a4ee8e3ae7e0690
Contents?: true
Size: 857 Bytes
Versions: 2
Compression:
Stored size: 857 Bytes
Contents
require 'pathname' module ArrayMatcher class BeDifferentArray def initialize(expected) @expected = expected end def matches?(actual) @extra = actual - @expected @missing = @expected - actual @extra + @missing != [] # Because the predicate is "be_different_array_from", the sense is inverted end def failure_message "expected a difference in the two lists, but got none" end def negative_failure_message "expected no difference, but result #{ [ (@missing.empty? ? nil : 'lacks '+@missing.sort.inspect), (@extra.empty? ? nil : 'has extra '+@extra.sort.inspect) ].compact * ' and ' }" end end def be_different_array_from(expected) BeDifferentArray.new(expected) end end Spec::Runner.configure do |config| config.include(ArrayMatcher) end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
activefacts-0.8.9 | spec/helpers/array_matcher.rb |
activefacts-0.8.8 | spec/helpers/array_matcher.rb |