Sha256: b58e6110d30f8b2962b9a9e2a0c0bfb43be83029afc793b949dff758f46a5250

Contents?: true

Size: 719 Bytes

Versions: 2

Compression:

Stored size: 719 Bytes

Contents

require 'spec_helper'

describe Mongo::Lock do

  describe '.clear_expired' do

    it "deletes expired locks in all collections" do
      Mongo::Lock.configure collections: { default: collection, other: other_collection }
      collection.insert owner: 'owner', key: 'my_lock', expires_at: 1.minute.from_now
      collection.insert owner: 'owner', key: 'my_lock', expires_at: 1.minute.ago
      other_collection.insert owner: 'owner', key: 'my_lock', expires_at: 1.minute.from_now
      other_collection.insert owner: 'owner', key: 'my_lock', expires_at: 1.minute.ago
      Mongo::Lock.clear_expired
      expect(collection.find().count).to be 1
      expect(other_collection.find().count).to be 1
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mongo-lock-1.1.0 spec/clear_expired_spec.rb
mongo-lock-1.0.0 spec/clear_expired_spec.rb