Sha256: 44a01d780322749e771b056f63d930e091b4c104b3b6cffe5a220b86dc9726a5

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

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

module Propono
  class PublisherTest < Minitest::Test

    def test_initialization
      notifier = Publisher.new
      refute notifier.nil?
    end

    def test_self_publish_calls_publish
      topic = "topic123"
      message = "message123"
      Publisher.any_instance.expects(:publish).with(topic, message)
      Publisher.new.publish(topic, message)
    end

    def test_publish_should_call_sns_on_correct_topic
    end

    def test_publish_should_call_sns_with_message
    end

    def test_publish_creates_a_topic
      topic = "Malcs_topic"
      TopicCreator.expects(:find_or_create).with(topic)
      Publisher.new.publish(topic, "Foobar")
    end

    def test_publish_should_raise_exception_if_topic_is_nil
      assert_raises(PublisherError, "Topic is nil") do
        Publisher.publish(nil, "foobar")
      end
    end

    def test_publish_should_raise_exception_if_message_is_nil
      assert_raises(PublisherError, "Message is nil") do
        Publisher.publish("foobar", nil)
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
propono-0.0.1 test/publisher_test.rb