Sha256: 98767056e037527a12b8ee61509566596ef0bf86e881784c9c5f09c69f3f03f5
Contents?: true
Size: 896 Bytes
Versions: 2
Compression:
Stored size: 896 Bytes
Contents
require 'spec_helper' describe Mongo::Lock do describe '#initialise' do let(:lock) { Mongo::Lock.new 'my_lock', owner: 'spence', timeout_in: 0.01, frequency: 0.01 } it "creates a new configuration object" do expect(lock.configuration).to be_a Mongo::Lock::Configuration end it "passes it the class configuration" do Mongo::Lock.configure limit: 3 expect(lock.configuration.limit).to be 3 end it "allows override of the class configuration" do Mongo::Lock.configure limit: 3 lock = Mongo::Lock.new 'my_lock', limit: 4 expect(lock.configuration.limit).to be 4 end context "when the key is already acquired by this owner" do it "acquires that lock" do collection.insert key: 'my_lock', owner: 'spence', expires_at: 1.minute.from_now expect(lock.acquired?).to be_true end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mongo-lock-1.1.0 | spec/initialise_spec.rb |
mongo-lock-1.0.0 | spec/initialise_spec.rb |