Sha256: 199c46fe3722933913e5c5f0858e9fdd2b9a23b1afcc2af01b9b98177a247302

Contents?: true

Size: 1.63 KB

Versions: 7

Compression:

Stored size: 1.63 KB

Contents

describe 'adapter_datamapper', broken: defined?(JRUBY_VERSION), adapter: :DataMapper do
  before :all do
    require 'dm-core'

    # DataMapper needs default repository to be setup
    DataMapper.setup(:default, adapter: :in_memory)
  end
  
  moneta_build do
    Moneta::Adapters::DataMapper.new(setup: "mysql://#{mysql_username}:#{mysql_password}@localhost/#{mysql_database1}", table: "adapter_datamapper")
  end

  moneta_specs ADAPTER_SPECS.without_increment.with_values(:nil).without_values(:binary)
    
  it 'does not cross contaminate when storing' do
    first = Moneta::Adapters::DataMapper.new(setup: "mysql://#{mysql_username}:#{mysql_password}@localhost/#{mysql_database1}", table: "datamapper_first")
    first.clear

    second = Moneta::Adapters::DataMapper.new(repository: :sample, setup: "mysql://#{mysql_username}:#{mysql_password}@localhost/#{mysql_database1}", table: "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: "mysql://#{mysql_username}:#{mysql_password}@localhost/#{mysql_database1}", table: "datamapper_first")
    first.clear

    second = Moneta::Adapters::DataMapper.new(repository: :sample, setup: "mysql://#{mysql_username}:#{mysql_password}@localhost/#{mysql_database1}", table: "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

7 entries across 7 versions & 1 rubygems

Version Path
moneta-1.4.1 spec/moneta/adapters/datamapper/adapter_datamapper_spec.rb
moneta-1.4.0 spec/moneta/adapters/datamapper/adapter_datamapper_spec.rb
moneta-1.3.0 spec/moneta/adapters/datamapper/adapter_datamapper_spec.rb
moneta-1.2.1 spec/moneta/adapters/datamapper/adapter_datamapper_spec.rb
moneta-1.2.0 spec/moneta/adapters/datamapper/adapter_datamapper_spec.rb
moneta-1.1.1 spec/moneta/adapters/datamapper/adapter_datamapper_spec.rb
moneta-1.1.0 spec/moneta/adapters/datamapper/adapter_datamapper_spec.rb