test/models/message_queue_test.rb in alondra-0.1.0 vs test/models/message_queue_test.rb in alondra-0.1.1

- old
+ new

@@ -15,31 +15,31 @@ teardown do MessageQueue.instance.instance_variable_set :@event_router, @original_event_router end - # test "a message pushed asynchronously to the queue is received by the event router" do - # assert MessageQueueClient.instance.class == AsyncMessageQueueClient - # - # MessageQueueClient.push @event - # - # sleep(0.1) - # - # assert received(@event) - # end - # - # test "a message pushed synchronously to the queue is received by the event router" do - # - # client = MessageQueueClient.sync_instance - # context = client.send :context - # assert context.class == ZMQ::Context - # - # client.send_message(@event) - # - # sleep(0.1) - # - # assert received(@event) - # end + test "a message pushed asynchronously to the queue is received by the event router" do + assert MessageQueueClient.instance.class == AsyncMessageQueueClient + + MessageQueueClient.push @event + + sleep(0.1) + + assert received(@event) + end + + test "a message pushed synchronously to the queue is received by the event router" do + + client = MessageQueueClient.sync_instance + context = client.send :context + assert context.class == ZMQ::Context + + client.send_message(@event) + + sleep(0.1) + + assert received(@event) + end test "message queue still works when an exception is thrown while processing an event" do 3.times do bogus = BogusEvent.new :event => :custom, :resource => @chat, :channel => '/chats/' \ No newline at end of file