Sha256: 8453c118f20f5f5bebfb3c6be52f18479681acbf9780e27661b9ee4a0f6041a8

Contents?: true

Size: 1.5 KB

Versions: 44

Compression:

Stored size: 1.5 KB

Contents

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

  service = Fog::Rackspace::Queues.new
  queue = service.queues.create({
    :name => "fog_instance_#{Time.now.to_i.to_s}",
  })
  options = {
    :ttl => VALID_TTL,
    :body => { :key => 'value' }
  }
  begin
    model_tests(queue.messages, options) do
      tests('#href').returns(true) do
        !@instance.href.nil?
      end
      tests('#identity').returns(true) do
        !@instance.identity.nil?
      end
      tests('#save => Fails to update').raises(StandardError) do
        @instance.save
      end
    end

    message = queue.messages.create(options.merge({:claim_id => '10'}))
    tests('#destroy => fails if claim is not valid').raises(Fog::Rackspace::Queues::ServiceError) do
      #API team should be fixing this so that it errors in this scenario
      pending
      message.destroy
    end
  ensure
    queue.destroy
  end

  tests('identity') do
    tests('nil') do
      message = Fog::Rackspace::Queues::Message.new :href => nil
      returns(nil) { message.id }
    end
    tests('with claim id') do
      message = Fog::Rackspace::Queues::Message.new :href => '/v1/queues/queue1/messages/528b7e4bb04a584f2eb805a3?claim_id=528b7e6aef913e6d2977ee6d'
      returns('528b7e4bb04a584f2eb805a3') { message.id }
    end
    tests('without claim id') do
      message = Fog::Rackspace::Queues::Message.new :href => '/v1/queues/queue1/messages/528b7e4bb04a584f2eb805a3'
      returns('528b7e4bb04a584f2eb805a3') { message.id }
    end
  end

end

Version data entries

44 entries across 42 versions & 7 rubygems

Version Path
fog-rackspace-0.1.6 tests/rackspace/models/queues/message_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-rackspace-0.1.5/tests/rackspace/models/queues/message_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-rackspace-0.1.5/tests/rackspace/models/queues/message_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-rackspace-0.1.5/tests/rackspace/models/queues/message_tests.rb
fog-rackspace-0.1.5 tests/rackspace/models/queues/message_tests.rb
fog-rackspace-0.1.4 tests/rackspace/models/queues/message_tests.rb
fog-rackspace-0.1.3 tests/rackspace/models/queues/message_tests.rb
fog-rackspace-0.1.2 tests/rackspace/models/queues/message_tests.rb
fog-rackspace-0.1.1 tests/rackspace/models/queues/message_tests.rb
fog-rackspace-0.1.0 tests/rackspace/models/queues/message_tests.rb
fog-1.37.0 tests/rackspace/models/queues/message_tests.rb
fog-1.36.0 tests/rackspace/models/queues/message_tests.rb
fog-1.35.0 tests/rackspace/models/queues/message_tests.rb
fog-2.0.0.pre.0 tests/rackspace/models/queues/message_tests.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/tests/rackspace/models/queues/message_tests.rb
fog-1.34.0 tests/rackspace/models/queues/message_tests.rb
fog-1.33.0 tests/rackspace/models/queues/message_tests.rb
fog-1.32.0 tests/rackspace/models/queues/message_tests.rb
fog-1.31.0 tests/rackspace/models/queues/message_tests.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/tests/rackspace/models/queues/message_tests.rb