Sha256: 7b54263720aa06885669d7d06e37679f29479fa17a183e84a670f171dd7ac3be
Contents?: true
Size: 814 Bytes
Versions: 1
Compression:
Stored size: 814 Bytes
Contents
shared_examples "MongoLock driver that can find if a lock have expired" do describe Mongo::Lock do describe '#expired?' do let(:lock) { Mongo::Lock.new 'my_lock', owner: 'spence', timeout_in: 0.01, frequency: 0.01 } context "when the lock has not been acquired" do it "returns false" do sleep 0.02 expect(lock.expired?).to be_false end end context "when the lock has expired" do it "returns true" do lock.acquire expire_in: 0.01 sleep 0.02 expect(lock.expired?).to be_true end end context "when the lock hasn't expired" do it "returns false" do lock.acquire expire_in: 0.1 expect(lock.expired?).to be_false end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mongo-lock-1.2.0 | spec/examples/expired_example.rb |