diff options
author | Matthias Hecker <apoc@geekosphere.org> | 2015-06-14 01:36:33 +0200 |
---|---|---|
committer | Matthias Hecker <apoc@geekosphere.org> | 2015-06-14 01:36:33 +0200 |
commit | d864b0348f25d845fa312cedfd5011b2d25022dc (patch) | |
tree | 27a48c76edc4ab3e104eb061fd84fb486da4e7a4 /test | |
parent | 613750983b43546d8bd2732c9159ff766a1c42bd (diff) |
journal: unsubscribe added
Diffstat (limited to 'test')
-rw-r--r-- | test/test_journal.rb | 11 |
1 files changed, 10 insertions, 1 deletions
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 |