test/services/publisher_test.rb in propono-0.8.0 vs test/services/publisher_test.rb in propono-0.8.2

- old
+ new

@@ -23,10 +23,16 @@ def test_protocol_should_be_sns_by_default publisher = Publisher.new('topic', 'message') assert_equal :sns, publisher.protocol end + def test_publish_logs + client = Publisher.new("foo", "bar") + Propono.config.logger.expects(:info).with() {|x| x =~ /^Propono: Publishing bar to foo via sns.*/} + client.send(:publish) + end + def test_publish_proxies_to_sns publisher = Publisher.new('topic', 'message') publisher.expects(:publish_via_sns) publisher.publish end @@ -47,11 +53,12 @@ sns = mock() sns.expects(:publish).with(topic_arn, message) publisher = Publisher.new(topic, message) publisher.stubs(sns: sns) - ~publisher.send(:publish_via_sns) + thread = publisher.send(:publish_via_sns) + thread.join end def test_publish_via_sns_should_accept_a_hash_for_message topic = "topic123" message = {something: ['some', 123, true]} @@ -62,12 +69,13 @@ sns = mock() sns.expects(:publish).with(topic_arn, message.to_json) publisher = Publisher.new(topic, message) publisher.stubs(sns: sns) - ~publisher.send(:publish_via_sns) + thread = publisher.send(:publish_via_sns) + thread.join end - + def test_publish_via_sns_should_return_future_of_the_sns_response topic = "topic123" message = "message123" topic_arn = "arn123" topic = Topic.new(topic_arn)