Sha256: 08b5f4ff8a1502fa8d1bb756de38bfea425609f2e1faca36389211afd2351c9d

Contents?: true

Size: 980 Bytes

Versions: 11

Compression:

Stored size: 980 Bytes

Contents

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

module Propono
  class QueueCreatorTest < Minitest::Test

    def test_create_topic_called_on_sqs
      sqs = mock()
      sqs.expects(:create_queue).with("foobar").returns(mock(body: { "QueueUrl" => "Foobar"}))

      creator = QueueCreator.new("foobar")
      creator.stubs(sqs: sqs)

      creator.find_or_create
    end

    def test_returns_url
      url = "malcs_happy_queue"
      result = mock(body: { "QueueUrl" => url})
      sqs = mock(create_queue: result)

      creator = QueueCreator.new("foobar")
      creator.stubs(sqs: sqs)

      queue = creator.find_or_create
      assert_equal url, queue.url
    end

    def test_should_raise_exception_if_no_queue_returned
      result = mock(body: {})
      sqs = mock(create_queue: result)

      creator = QueueCreator.new("foobar")
      creator.stubs(sqs: sqs)

      assert_raises QueueCreatorError do
        creator.find_or_create
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
propono-0.5.6 test/queue_creator_test.rb
propono-0.5.5 test/queue_creator_test.rb
propono-0.5.4 test/queue_creator_test.rb
propono-0.5.3 test/queue_creator_test.rb
propono-0.5.2 test/queue_creator_test.rb
propono-0.5.1 test/queue_creator_test.rb
propono-0.5.0 test/queue_creator_test.rb
propono-0.4.0 test/queue_creator_test.rb
propono-0.3.0 test/queue_creator_test.rb
propono-0.2.0 test/queue_creator_test.rb
propono-0.1.0 test/queue_creator_test.rb