From d864b0348f25d845fa312cedfd5011b2d25022dc Mon Sep 17 00:00:00 2001 From: Matthias Hecker Date: Sun, 14 Jun 2015 01:36:33 +0200 Subject: journal: unsubscribe added --- test/test_journal.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/test_journal.rb b/test/test_journal.rb index d7a70a7c..cee8da0f 100644 --- a/test/test_journal.rb +++ b/test/test_journal.rb @@ -160,7 +160,7 @@ class JournalBrokerTest < Test::Unit::TestCase journal = JournalBroker.new # subscribe to messages: - journal.subscribe(Query.define { topic 'foo' }) do |message| + sub = journal.subscribe(Query.define { topic 'foo' }) do |message| received << message end @@ -172,6 +172,15 @@ class JournalBrokerTest < Test::Unit::TestCase # wait for messages to be consumed: sleep 0.1 assert_equal(2, received.length) + + received.clear + + journal.publish 'foo', {} + sleep 0.1 + sub.cancel + journal.publish 'foo', {} + sleep 0.1 + assert_equal(1, received.length) end end -- cgit v1.2.3