Sha256: c80097e0359e7cad41ea60d894c7aa445fcb995a6b197c62983cb5d2418003b3

Contents?: true

Size: 971 Bytes

Versions: 10

Compression:

Stored size: 971 Bytes

Contents

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

module Propono
  class TopicCreatorTest < Minitest::Test

    def test_create_topic_called_on_sns
      sns = mock()
      sns.expects(:create_topic).with("foobar").returns(mock(body: { "TopicArn" => @arn}))

      creator = TopicCreator.new("foobar")
      creator.stubs(sns: sns)

      creator.find_or_create
    end

    def test_returns_arn
      arn = "malcs_happy_arn"
      result = mock(body: { "TopicArn" => arn})
      sns = mock(create_topic: result)

      creator = TopicCreator.new("foobar")
      creator.stubs(sns: sns)

      topic = creator.find_or_create
      assert_equal arn, topic.arn
    end

    def test_should_raise_exception_if_no_arn_returned
      result = mock(body: {})
      sns = mock(create_topic: result)

      creator = TopicCreator.new("foobar")
      creator.stubs(sns: sns)

      assert_raises TopicCreatorError do
        creator.find_or_create
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

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