Sha256: 385d8f447b75a7fd74f11878a659259aefeb9d534e709b8bc09b4958d44b5b42

Contents?: true

Size: 763 Bytes

Versions: 1

Compression:

Stored size: 763 Bytes

Contents

RSpec::Matchers.define :have_track do |accessor, expected|
  match do |actual|
    if actual.__history
      actual.__history.map{|x|x.send(accessor)} == expected
    else
      [] == expected
    end
  end

  failure_message_for_should do |actual|
    if actual.__history
      "expected that #{actual.__history.map{|x|x.send(accessor)}} would be a precise multiple of #{expected}"
    else
      "expected that #{[]} would be a precise multiple of #{expected}"
    end
  end

  failure_message_for_should_not do |actual|
    if actual.__history
      "expected that #{actual.__history.map{|x|x.send(accessor)}} would not be a precise multiple of #{expected}"
    else
      "expected that #{[]} would not be a precise multiple of #{expected}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
object-history-0.0.2 lib/object-history/rspec-matchers.rb