test/propono_test.rb in propono-0.5.6 vs test/propono_test.rb in propono-0.6.0

- old
+ new

@@ -1,27 +1,48 @@ require File.expand_path('../test_helper', __FILE__) module Propono class ProponoTest < Minitest::Test - def setup - super - @var1 = "Foobar" - @var2 = 123 + def test_publish_calls_publisher_publish + topic, message = "Foo", "Bar" + Publisher.expects(:publish).with(topic, message, {}) + Propono.publish(topic, message) end - def test_publish_calls_publisher_public - Publisher.expects(:publish).with(@var1, @var2) - Propono.publish(@var1, @var2) + def test_subscribe_by_queue_calls_subscribe + topic = 'foobar' + Subscriber.expects(:subscribe_by_queue).with(topic) + Propono.subscribe_by_queue(topic) end + def test_subscribe_by_post_calls_subscribe + topic, endpoint = 'foo', 'bar' + Subscriber.expects(:subscribe_by_post).with(topic, endpoint) + Propono.subscribe_by_post(topic, endpoint) + end + def test_listen_to_queue_calls_queue_listener - QueueListener.expects(:listen).with(@var1, @var2) - Propono.listen_to_queue(@var1, @var2) + topic = 'foobar' + QueueListener.expects(:listen).with(topic) + Propono.listen_to_queue(topic) end def test_listen_to_udp_calls_udp_listener - UdpListener.expects(:listen).with(@var1, @var2) - Propono.listen_to_udp(@var1, @var2) + UdpListener.expects(:listen).with() + Propono.listen_to_udp() + end + + def test_proxy_udp_calls_listen + UdpListener.expects(:listen).with() + Propono.proxy_udp() + end + + def test_proxy_udp_calls_publish_in_the_block + topic = "foobar" + message = "message" + Propono.stubs(:listen_to_udp).yields(topic, message) + Publisher.expects(:publish).with(topic, message, {}) + Propono.proxy_udp end end end