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.19.0.20140212012611 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.19.0.20140110004459 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.19.0.20140110003812 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.19.0.20140109202555 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.19.0.20140107192102 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.19.0.20140107142106 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.19.0.20131219203941 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.18.0.20131219193542 tests/rackspace/models/queues/claims_tests.rb
fog-1.19.0 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.18.0.20131219033443 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.18.0.20131219032002 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.18.0.20131219030716 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.18.0.20131219022322 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.18.0.20131218202447 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.18.0.20131209091424 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.18.0.20131209090811 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.18.0.20131206115947 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.18.0.20131205181604 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.18.0.20131127194823 tests/rackspace/models/queues/claims_tests.rb
fog-maestrodev-1.18.0.20131126183714 tests/rackspace/models/queues/claims_tests.rb