Sha256: f6e35ca508366c968446bc953d81bb0ddc5d83a2251645a80473ce09a1f98d31

Contents?: true

Size: 920 Bytes

Versions: 5

Compression:

Stored size: 920 Bytes

Contents

require File.expand_path('../integration_test', __FILE__)

module Propono
  class SnsToSqsTest < IntegrationTest
    def test_the_message_gets_there
      topic = "test-topic"
      text = "This is my message"
      flunks = []

      Propono.subscribe_by_queue(topic)

      thread = Thread.new do
        begin
          Propono.listen_to_queue(topic) do |message, context|
            flunks << "Wrong message" unless message == text
            flunks << "Wrong id" unless context[:id] =~ Regexp.new("[a-z0-9]{6}")
            break
          end
        rescue => e
          flunks << e.message
        ensure
          thread.terminate
        end
      end

      sleep(2) # Make sure the listener has started

      Propono.publish(topic, text)
      flunks << "Test Timeout" unless wait_for_thread(thread)
      flunk(flunks.join("\n")) unless flunks.empty?
    ensure
      thread.terminate
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
propono-0.11.1 test/integration/sns_to_sqs_test.rb
propono-0.11.0 test/integration/sns_to_sqs_test.rb
propono-0.10.0 test/integration/sns_to_sqs_test.rb
propono-0.9.1 test/integration/sns_to_sqs_test.rb
propono-0.9.0 test/integration/sns_to_sqs_test.rb