Sha256: 59a475976fcbbc1ae3ca6ede7994ecd9f80e1020a36e1dc4c234df51e9d3f133

Contents?: true

Size: 992 Bytes

Versions: 15

Compression:

Stored size: 992 Bytes

Contents

require 'spec_helper'

describe PerfectQueue::Client do
  describe '#preempt' do
    it '(key)' do
      backend = double('backend')
      alive_time = double('alive_time')
      object_double('PerfectQueue::Backend', new_backend: backend).as_stubbed_const
      client = Client.new({alive_time: alive_time})
      ret = double('ret')
      key = double('key')
      expect(backend).to receive(:preempt).with(key, alive_time, {}).and_return(ret)
      expect(client.preempt(key)).to eq(ret)
    end

    it '(key, options)' do
      backend = double('backend')
      alive_time = double('alive_time')
      object_double('PerfectQueue::Backend', new_backend: backend).as_stubbed_const
      client = Client.new({alive_time: alive_time})
      ret = double('ret')
      key = double('key')
      options = {alive_time: alive_time}
      expect(backend).to receive(:preempt).with(key, alive_time, options).and_return(ret)
      expect(client.preempt(key, options)).to eq(ret)
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
perfectqueue-0.8.54 spec/client_spec.rb
perfectqueue-0.10.1 spec/client_spec.rb
perfectqueue-0.8.53 spec/client_spec.rb
perfectqueue-0.8.52 spec/client_spec.rb
perfectqueue-0.10.0 spec/client_spec.rb
perfectqueue-0.8.51 spec/client_spec.rb
perfectqueue-0.8.50 spec/client_spec.rb
perfectqueue-0.9.2 spec/client_spec.rb
perfectqueue-0.9.1 spec/client_spec.rb
perfectqueue-0.9.0 spec/client_spec.rb
perfectqueue-0.8.49 spec/client_spec.rb
perfectqueue-0.8.48 spec/client_spec.rb
perfectqueue-0.8.47 spec/client_spec.rb
perfectqueue-0.8.46 spec/client_spec.rb
perfectqueue-0.8.45 spec/client_spec.rb