Sha256: cf00a22937f12c6916a8042e8d353776f28c0ebb6c9041d012ed53c4e3d9631d

Contents?: true

Size: 1.54 KB

Versions: 2

Compression:

Stored size: 1.54 KB

Contents

# Generated by generate.rb
require 'helper'

describe_moneta "adapter_datamapper" do
  require 'dm-core'
  DataMapper.setup(:default, :adapter => :in_memory)
  def new_store
    Moneta::Adapters::DataMapper.new(:setup => "sqlite3://#{make_tempdir}/adapter_datamapper")
  end

  def load_value(value)
    Marshal.load(value)
  end

  include_context 'setup_store'
  it_should_behave_like 'not_increment'
  it_should_behave_like 'null_stringkey_stringvalue'
  it_should_behave_like 'persist_stringkey_stringvalue'
  it_should_behave_like 'returndifferent_stringkey_stringvalue'
  it_should_behave_like 'store_stringkey_stringvalue'
  it 'does not cross contaminate when storing' do
    first = Moneta::Adapters::DataMapper.new(:setup => "sqlite3://#{make_tempdir}/datamapper-first")
    first.clear

    second = Moneta::Adapters::DataMapper.new(:repository => :sample, :setup => "sqlite3://#{make_tempdir}/datamapper-second")
    second.clear

    first['key'] = 'value'
    second['key'] = 'value2'

    first['key'].should == 'value'
    second['key'].should == 'value2'
  end

  it 'does not cross contaminate when deleting' do
    first = Moneta::Adapters::DataMapper.new(:setup => "sqlite3://#{make_tempdir}/datamapper-first")
    first.clear

    second = Moneta::Adapters::DataMapper.new(:repository => :sample, :setup => "sqlite3://#{make_tempdir}/datamapper-second")
    second.clear

    first['key'] = 'value'
    second['key'] = 'value2'

    first.delete('key').should == 'value'
    first.key?('key').should be_false
    second['key'].should == 'value2'
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
moneta-0.7.3 spec/moneta/adapter_datamapper_spec.rb
moneta-0.7.2 spec/moneta/adapter_datamapper_spec.rb