Sha256: 122741994fcfbb38d3b26a6842000e539dbee386a5fcf420bfbfb059d2c5e07b

Contents?: true

Size: 1.33 KB

Versions: 34

Compression:

Stored size: 1.33 KB

Contents

Shindo.tests('Fog::Rackspace::Queues | claims', ['rackspace']) do

  pending if Fog.mocking?

  service = Fog::Rackspace::Queues.new
  queue = service.queues.create({
    :name => "fog_queue_#{Time.now.to_i.to_s}",
  })
  queue.messages.create({
    :ttl => VALID_TTL,
    :body => { :random => :body }
  })
  params = {
    :ttl => VALID_TTL,
    :grace => VALID_GRACE
  }

  begin
    collection_tests(queue.claims, params, false)

    tests('creating claims when there are no messages') do

      before do
        #clear all message from queue
        queue.messages.all.each do |message|
          message.destroy
        end
      end

      tests("#create(#{params.inspect}) => with no messages does not show up in claim list") do
        returns(false) { queue.claims.create(params) }
        returns(true) { queue.claims.empty? }
      end
    end

    tests('create claims when there are messages') do

      before do
        queue.messages.create({
          :ttl => VALID_TTL,
          :body => { :random => :body }
        })
      end

      tests("#create(#{params.inspect}) => with messages does show up in claim list") do
        returns(true) do
          queue.claims.create(params).instance_of? Fog::Rackspace::Queues::Claim
        end
        returns(false) { queue.claims.empty? }
      end
    end
  ensure
    queue.destroy
  end
end

Version data entries

34 entries across 34 versions & 2 rubygems

Version Path
fog-maestrodev-1.18.0.20131126122111 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.18.0.20131125111730 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.18.0.20131125083406 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.18.0.20131123105121 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.18.0.20131122203507 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.18.0.20131121075022 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.18.0.20131118164830 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.18.0.20131115184302 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.18.0.20131114200144 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.18.0.20131112185232 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.18.0.20131111203459 tests/rackspace/models/queues/claims_tests.rb
fog-1.18.0 tests/rackspace/models/queues/claims_tests.rb
fog-1.17.0 tests/rackspace/models/queues/claims_tests.rb
fog-1.16.0 tests/rackspace/models/queues/claims_tests.rb