forked from ruby-amqp/march_hare
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce HotBunnies::Queue::Subscription#active? and #shutdown!, add…
… test example for cancelling A missing piece discovered during the development of the next generation travis-ci.org worker.
- Loading branch information
1 parent
e9c4dd6
commit c80e2f1
Showing
2 changed files
with
59 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require "spec_helper" | ||
|
||
describe "Queue consumer" do | ||
let(:connection) { HotBunnies.connect } | ||
let(:channel) { connection.create_channel } | ||
|
||
after :each do | ||
channel.close | ||
connection.close | ||
end | ||
|
||
it "provides predicates" do | ||
queue = channel.queue("", :auto_delete => true) | ||
|
||
subscription = queue.subscribe(:blocking => false) { |_, _| nil } | ||
|
||
# consumer tag will be sent by the broker, so this happens | ||
# asynchronously and we can either add callbacks/use latches or | ||
# just wait. MK. | ||
sleep(1.0) | ||
subscription.should be_active | ||
|
||
subscription.cancel | ||
sleep(1.0) | ||
subscription.should_not be_active | ||
|
||
subscription.shutdown! | ||
end | ||
end |