-
Notifications
You must be signed in to change notification settings - Fork 46
/
queue_unbind_spec.rb
50 lines (34 loc) · 1.05 KB
/
queue_unbind_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
RSpec.describe "Any queue" do
#
# Environment
#
let(:connection) { MarchHare.connect }
let(:channel) { connection.create_channel }
after :each do
channel.close
connection.close
end
#
# Examples
#
it "can be unbound from amq.fanout" do
exchange = channel.exchange("amq.fanout", :type => :fanout, :durable => true, :auto_delete => false)
queue = channel.queue("", :exclusive => true)
queue.bind(exchange)
exchange.publish("", :routing_key => queue.name)
expect(queue.get).not_to be_nil
queue.unbind(exchange)
exchange.publish("")
expect(queue.get).to be_nil
end
it "can be unbound from a client-declared exchange" do
exchange = channel.exchange("hot.bunnies.fanout#{Time.now.to_i}", :type => :fanout, :durable => false)
queue = channel.queue("", :exclusive => true)
queue.bind(exchange)
exchange.publish("", :routing_key => queue.name)
expect(queue.get).not_to be_nil
queue.unbind(exchange)
exchange.publish("")
expect(queue.get).to be_nil
end
end