summaryrefslogtreecommitdiff
path: root/test/test_journal.rb
diff options
context:
space:
mode:
authorMatthias Hecker <apoc@geekosphere.org>2015-06-14 01:36:33 +0200
committerMatthias Hecker <apoc@geekosphere.org>2015-06-14 01:36:33 +0200
commitd864b0348f25d845fa312cedfd5011b2d25022dc (patch)
tree27a48c76edc4ab3e104eb061fd84fb486da4e7a4 /test/test_journal.rb
parent613750983b43546d8bd2732c9159ff766a1c42bd (diff)
journal: unsubscribe added
Diffstat (limited to 'test/test_journal.rb')
-rw-r--r--test/test_journal.rb11
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