Sha256: 572baf78f4d0c5bda3f0fdd0766e78fbd83816c81694ad57208dd917b2c37458

Contents?: true

Size: 589 Bytes

Versions: 2

Compression:

Stored size: 589 Bytes

Contents

require 'helper'

describe "Mongo atomic adapter" do
  before do
    @client = Mongo::Connection.new.db('test')['test']
    @adapter = Adapter[adapter_name].new(@client)
    @adapter.clear
  end

  let(:adapter_name) { :mongo_atomic }

  let(:adapter) { @adapter }
  let(:client)  { @client }

  it_should_behave_like 'a mongo adapter'

  it "allows updating only part of a document" do
    oid = BSON::ObjectId.new
    adapter.write(oid, {'a' => 'c', 'b' => 'd'})
    adapter.write(oid, {'a' => 'z'})
    adapter.read(oid).should eq({
      'a' => 'z',
      'b' => 'd',
    })
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
adapter-mongo-0.7.0 spec/mongo_atomic_spec.rb
adapter-mongo-0.6.0 spec/mongo_atomic_spec.rb