Sha256: 2489c71de71a51c4350bfede7a8ac40514420360acc086fc311d031ce9927843

Contents?: true

Size: 980 Bytes

Versions: 2

Compression:

Stored size: 980 Bytes

Contents

require "integration/test_helper"
require "azure/service_bus/queues"
require "azure/service_bus/brokered_message"

describe "Delete a Message from a Queue" do

  after do
    ServiceBusQueueNameHelper.clean
  end

  before do
    @queue = Azure::ServiceBus::Queues.create(ServiceBusQueueNameHelper.name)
  end

  it "should be able to read-delete a message from a queue" do
    message = Azure::ServiceBus::BrokeredMessage.new("some text") {|m| m.to = 'me' }
    Azure::ServiceBus::Queues.send_message_to_queue(@queue, message)

    retrieved = Azure::ServiceBus::Queues.peek_lock_message_from_queue(@queue)

    result = Azure::ServiceBus::Queues.delete_message_from_queue(@queue, retrieved)
    result.must_equal true

    # it should be deleted
    retrieved = Azure::ServiceBus::Queues.peek_lock_message_from_queue(@queue, :timeout => 2)
    refute retrieved.valid?
    retrieved.error.message.must_equal "No messages available within the specified timeout period."
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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