Sha256: 59628c20a1809fc68f92254eb505397849620d29e7fa15babe5edc7163d45052

Contents?: true

Size: 489 Bytes

Versions: 4

Compression:

Stored size: 489 Bytes

Contents

RSpec::Matchers.define :have_persisted do |relation_name, data|
  match do |datastore|
    datastore[relation_name].find { |record|
      if data.respond_to?(:===)
        data === record
      else
        data == record
      end
    }
  end

  failure_message do |datastore|
    "expected #{datastore[relation_name]} to have persisted #{data.inspect} in #{relation_name}"
  end

  failure_message_when_negated do |datastore|
    failure_message.gsub("to have", "not to have")
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
terrestrial-0.5.0 spec/support/have_persisted_matcher.rb
terrestrial-0.3.0 spec/support/have_persisted_matcher.rb
terrestrial-0.1.1 spec/support/have_persisted_matcher.rb
sequel_mapper-0.0.3 spec/support/have_persisted_matcher.rb