Sha256: 8230a95dd99c3d25378ec03882875e475ec2847883f7014332592cc5f3a1f8c3

Contents?: true

Size: 1.54 KB

Versions: 4

Compression:

Stored size: 1.54 KB

Contents

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

module Propono
  class ClientTest < Minitest::Test

    def test_publish_calls_publisher_publish
      topic, message = "Foo", "Bar"
      client = Propono::Client.new
      Publisher.expects(:publish).with(
        client.aws_client,
        client.config,
        topic,
        message,
        {}
      )
      client.publish(topic, message)
    end

    def test_publish_sets_suffix_publish
      queue_suffix = "-bar"
      topic = "foo"
      message = "asdasdasda"

      client = Propono::Client.new
      client.config.queue_suffix = queue_suffix
      Publisher.expects(:publish).with(
        client.aws_client,
        client.config,
        "#{topic}#{queue_suffix}",
        message,
        {}
      )
      client.publish(topic, message)
    end

    def test_listen_calls_queue_listener
      topic = 'foobar'

      client = Propono::Client.new
      QueueListener.expects(:listen).with(
        client.aws_client,
        client.config,
        topic
      )
      client.listen(topic)
    end

    def test_drain_queue_calls_queue_listener
      topic = 'foobar'

      client = Propono::Client.new
      QueueListener.expects(:drain).with(
        client.aws_client,
        client.config,
        topic
      )
      client.drain_queue(topic)
    end

    def test_block_configuration_syntax
      test_key = "foobar-123-access"
      client = Propono::Client.new do |config|
        config.access_key = test_key
      end
      assert_equal test_key, client.config.access_key
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
propono-2.0.0 test/components/client_test.rb
propono-2.0.0.rc3 test/components/client_test.rb
propono-2.0.0.rc2 test/components/client_test.rb
propono-2.0.0.rc1 test/components/client_test.rb