Sha256: b3d79bcf1054fdf5835a1d863419db6312e8eb157f77e384538c6707d0de25e0

Contents?: true

Size: 1.22 KB

Versions: 5

Compression:

Stored size: 1.22 KB

Contents

require 'support/aws'

describe "Actions for Messages", :acceptance do

  before do
    sqs.queues.create("test")
  end

  let(:sqs) { AWS::SQS.new }
  let(:queue) { sqs.queues.named("test") }

  specify "SendMessage" do
    msg = "this is my message"
    result = queue.send_message(msg)
    result.md5.should eq Digest::MD5.hexdigest(msg)
  end

  specify "ReceiveMessage" do
    body = "test 123"
    queue.send_message(body)
    message = queue.receive_message
    message.body.should eq body
  end

  specify "DeleteMessage" do
    queue.send_message("test")

    message1 = queue.receive_message
    message1.delete

    let_messages_in_flight_expire

    message2 = queue.receive_message
    message2.should be_nil
  end

  specify "DeleteMessageBatch" do
    queue.send_message("test1")
    queue.send_message("test2")

    message1 = queue.receive_message
    message2 = queue.receive_message
    queue.batch_delete(message1, message2)

    let_messages_in_flight_expire

    message3 = queue.receive_message
    message3.should be_nil
  end

  specify "SendMessageBatch" do
    bodies = %w(a b c)
    queue.batch_send(*bodies)

    messages = queue.receive_message(:limit => 10)
    messages.map(&:body).should match_array bodies
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fake_sqs-0.0.6 spec/acceptance/message_actions_spec.rb
fake_sqs-0.0.5 spec/acceptance/message_actions_spec.rb
fake_sqs-0.0.4 spec/acceptance/message_actions_spec.rb
fake_sqs-0.0.3 spec/acceptance/message_actions_spec.rb
fake_sqs-0.0.2 spec/acceptance/message_actions_spec.rb