test/integration/queue/create_message_test.rb in azure-0.7.0 vs test/integration/queue/create_message_test.rb in azure-0.7.1

- old
+ new

@@ -15,21 +15,21 @@ require "integration/test_helper" require "azure/queue/queue_service" describe Azure::Queue::QueueService do subject { Azure::Queue::QueueService.new } - + describe '#create_message' do let(:queue_name){ QueueNameHelper.name } let(:message_text) { "message text random value: #{QueueNameHelper.name}" } before { subject.create_queue queue_name } after { QueueNameHelper.clean } it "creates a message in the specified queue and returns nil on success" do result = subject.create_message(queue_name, message_text) result.must_be_nil - + result = subject.peek_messages queue_name result.wont_be_nil result.wont_be_empty result.length.must_equal 1 result[0].message_text.must_equal message_text @@ -40,11 +40,11 @@ let(:message_ttl) { 600 } it "the :visibility_timeout option causes the message to be invisible for a period of time" do result = subject.create_message(queue_name, message_text, { :visibility_timeout=> visibility_timeout }) result.must_be_nil - + result = subject.peek_messages queue_name result.length.must_equal 0 sleep(visibility_timeout) result = subject.peek_messages queue_name @@ -54,19 +54,19 @@ end it "the :message_ttl option modifies the expiration_date of the message" do result = subject.create_message(queue_name, message_text, { :message_ttl=> message_ttl }) result.must_be_nil - + result = subject.peek_messages queue_name result.wont_be_nil result.wont_be_empty message = result[0] message.message_text.must_equal message_text Time.parse(message.expiration_time).to_i.must_equal Time.parse(message.insertion_time).to_i + message_ttl end end - + it "errors on an non-existent queue" do assert_raises(Azure::Core::Http::HTTPError) do subject.create_message QueueNameHelper.name, message_text end end