Sha256: cdf9dfa7260bffec4b1874e4b764458c069a12a880b4c73300ccb0bc5319c872

Contents?: true

Size: 624 Bytes

Versions: 8

Compression:

Stored size: 624 Bytes

Contents

RSpec::Matchers.define :be_different_array_from do |x|
  match do |actual|
    perform_match(actual, expected)
    @extra + @missing != []
  end

  def perform_match(actual, expected)
    @extra = actual - expected
    @missing = expected - actual
  end

  failure_message_for_should do |actual|
    "expected a difference in the two lists, but got none"
  end

  failure_message_for_should_not do |actual|
    "expected no difference, but result #{
      [ (@missing.empty? ? nil : 'lacks '+@missing.sort.inspect),
        (@extra.empty? ? nil : 'has extra '+@extra.sort.inspect)
      ].compact * ' and '
    }"
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
activefacts-1.0.2 spec/helpers/array_matcher.rb
activefacts-1.0.1 spec/helpers/array_matcher.rb
activefacts-1.0.0 spec/helpers/array_matcher.rb
activefacts-0.8.18 spec/helpers/array_matcher.rb
activefacts-0.8.16 spec/helpers/array_matcher.rb
activefacts-0.8.15 spec/helpers/array_matcher.rb
activefacts-0.8.13 spec/helpers/array_matcher.rb
activefacts-0.8.12 spec/helpers/array_matcher.rb