Sha256: 019f49a10058681a37a2d7d5f8697bc7f507c540233d7028cd5a2e8ffde73bb4

Contents?: true

Size: 786 Bytes

Versions: 48

Compression:

Stored size: 786 Bytes

Contents

require 'spec_helper'
require 'flapjack/data/semaphore'

describe 'Flapjack::Data::Semaphore', :redis => true do

  it "obtains a lock that locks" do
    options = {:redis => @redis, :expiry => 60}
    lock_1 = Flapjack::Data::Semaphore.new('fooey', options)
    expect(lock_1.class).to eq(Flapjack::Data::Semaphore)
    expect{Flapjack::Data::Semaphore.new('fooey', options)}.to raise_error(Flapjack::Data::Semaphore::ResourceLocked)
  end

  it "releases a lock" do
    options = {:redis => @redis, :expiry => 60}
    lock_1 = Flapjack::Data::Semaphore.new('fooey', options)
    expect(lock_1.class).to eq(Flapjack::Data::Semaphore)
    lock_1.release

    lock_2 = Flapjack::Data::Semaphore.new('fooey', options)
    expect(lock_2.class).to eq(Flapjack::Data::Semaphore)
  end

end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
flapjack-0.8.7 spec/lib/flapjack/data/semaphore_spec.rb
flapjack-0.8.6 spec/lib/flapjack/data/semaphore_spec.rb
flapjack-0.8.5 spec/lib/flapjack/data/semaphore_spec.rb
flapjack-0.8.4 spec/lib/flapjack/data/semaphore_spec.rb
flapjack-0.8.3 spec/lib/flapjack/data/semaphore_spec.rb
flapjack-0.8.2 spec/lib/flapjack/data/semaphore_spec.rb
flapjack-0.8.1 spec/lib/flapjack/data/semaphore_spec.rb
flapjack-0.8.0 spec/lib/flapjack/data/semaphore_spec.rb