Sha256: 5bc055499d3c7d6bf9ec7cc2df992df8c619e811999cb39143277bf6d0c13c68

Contents?: true

Size: 974 Bytes

Versions: 25

Compression:

Stored size: 974 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

25 entries across 25 versions & 1 rubygems

Version Path
propono-1.7.0 test/services/topic_creator_test.rb
propono-1.6.0 test/services/topic_creator_test.rb
propono-1.5.0 test/services/topic_creator_test.rb
propono-1.4.0 test/services/topic_creator_test.rb
propono-1.3.0 test/services/topic_creator_test.rb
propono-1.2.0 test/services/topic_creator_test.rb
propono-1.1.3 test/services/topic_creator_test.rb
propono-1.1.2 test/services/topic_creator_test.rb
propono-1.1.1 test/services/topic_creator_test.rb
propono-1.1.0 test/services/topic_creator_test.rb
propono-1.0.0 test/services/topic_creator_test.rb
propono-1.0.0.rc3 test/services/topic_creator_test.rb
propono-1.0.0.rc2 test/services/topic_creator_test.rb
propono-1.0.0.rc1 test/services/topic_creator_test.rb
propono-0.11.1 test/services/topic_creator_test.rb
propono-0.11.0 test/services/topic_creator_test.rb
propono-0.10.0 test/services/topic_creator_test.rb
propono-0.9.1 test/services/topic_creator_test.rb
propono-0.9.0 test/services/topic_creator_test.rb
propono-0.8.2 test/services/topic_creator_test.rb