Sha256: bda83285c9481de55c49ecd2b221903e27fbf56eb0f26d33c1c3a9d7bfedbac3

Contents?: true

Size: 975 Bytes

Versions: 2

Compression:

Stored size: 975 Bytes

Contents

require "integration/test_helper"

describe "Delete Messages" do
  after do
    QueueNameHelper.clean
  end

  before do
    @queue = Azure::Queues.create(QueueNameHelper.name)
    @queue << "some sample text"
  end

  it "should be able to delete a message from the queue" do
    message = @queue.pop
    response = message.delete
    response.must_equal true
    assert message.frozen?
  end

  describe "Invalid delete operations" do
    it "shouldn't be able to delete an expired message" do
      skip "Docs say so but in fact this test it's not passing as of now"

      Azure::Queues::Message.new("some sample text") do |message|
        message.ttl = 1
      end

      message = @queue.pop
      sleep 1

      response = message.delete
      response.must_equal false
    end

    it "shouldn't be able to delete an already deleted message" do
      message = @queue.pop
      message.delete

      proc { message.delete }.must_raise RuntimeError
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
azure-0.1.1 test/integration/queues/delete_message_test.rb
azure-0.1.0 test/integration/queues/delete_message_test.rb