Sha256: 674729493ee01164cf68126f2f9c4ec7d638f66a976b276478897f337ddb532b

Contents?: true

Size: 978 Bytes

Versions: 3

Compression:

Stored size: 978 Bytes

Contents

require_relative "test_helper"

class MessageQueueTest < Test::Unit::TestCase
  def test_load_adapter
    adapter = MessageQueue.load_adapter(:bunny)
    assert_equal "MessageQueue::Adapters::Bunny", adapter.name

    adapter = MessageQueue.load_adapter(:foo)
    assert_nil adapter
  end

  def test_load_serializer
    serializer = MessageQueue.load_serializer(:message_pack)
    assert_equal "MessageQueue::Serializers::MessagePack", serializer.name

    serializer = MessageQueue.load_serializer(:foo)
    assert_nil serializer
  end

  def test_new_connection
    assert_raises RuntimeError do
      MessageQueue.new_connection(:adapter => :foo)
    end

    connection = MessageQueue.new_connection(:adapter => :bunny,
                                             :serializer => :message_pack,
                                             :uri => "amqp://user:pass@host/vhost")
    assert_equal "MessageQueue::Adapters::Bunny::Connection", connection.class.to_s
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
message_queue-0.0.4 test/message_queue_test.rb
message_queue-0.0.3 test/message_queue_test.rb
message_queue-0.0.2 test/message_queue_test.rb