bunny 1.7.1 → 2.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CONTRIBUTING.md +14 -0
- data/ChangeLog.md +21 -6
- data/Gemfile +1 -1
- data/LICENSE +1 -1
- data/README.md +22 -23
- data/bunny.gemspec +1 -1
- data/lib/bunny/channel.rb +12 -0
- data/lib/bunny/concurrent/continuation_queue.rb +30 -13
- data/lib/bunny/exchange.rb +0 -5
- data/lib/bunny/jruby/socket.rb +1 -2
- data/lib/bunny/queue.rb +9 -0
- data/lib/bunny/session.rb +7 -6
- data/lib/bunny/version.rb +1 -1
- data/spec/higher_level_api/integration/basic_ack_spec.rb +9 -9
- data/spec/higher_level_api/integration/basic_cancel_spec.rb +4 -4
- data/spec/higher_level_api/integration/basic_consume_spec.rb +22 -22
- data/spec/higher_level_api/integration/basic_consume_with_objects_spec.rb +1 -1
- data/spec/higher_level_api/integration/basic_get_spec.rb +2 -2
- data/spec/higher_level_api/integration/basic_nack_spec.rb +6 -6
- data/spec/higher_level_api/integration/basic_publish_spec.rb +14 -14
- data/spec/higher_level_api/integration/basic_qos_spec.rb +11 -2
- data/spec/higher_level_api/integration/basic_recover_spec.rb +2 -2
- data/spec/higher_level_api/integration/basic_reject_spec.rb +6 -6
- data/spec/higher_level_api/integration/basic_return_spec.rb +1 -1
- data/spec/higher_level_api/integration/channel_close_spec.rb +2 -2
- data/spec/higher_level_api/integration/channel_open_spec.rb +11 -11
- data/spec/higher_level_api/integration/connection_recovery_spec.rb +52 -52
- data/spec/higher_level_api/integration/connection_spec.rb +83 -83
- data/spec/higher_level_api/integration/connection_stop_spec.rb +11 -11
- data/spec/higher_level_api/integration/consistent_hash_exchange_spec.rb +2 -2
- data/spec/higher_level_api/integration/consumer_cancellation_notification_spec.rb +3 -3
- data/spec/higher_level_api/integration/dead_lettering_spec.rb +6 -6
- data/spec/higher_level_api/integration/exchange_bind_spec.rb +1 -1
- data/spec/higher_level_api/integration/exchange_declare_spec.rb +20 -20
- data/spec/higher_level_api/integration/exchange_delete_spec.rb +11 -11
- data/spec/higher_level_api/integration/exchange_unbind_spec.rb +2 -2
- data/spec/higher_level_api/integration/merry_go_round_spec.rb +2 -2
- data/spec/higher_level_api/integration/message_properties_access_spec.rb +27 -27
- data/spec/higher_level_api/integration/predeclared_exchanges_spec.rb +1 -1
- data/spec/higher_level_api/integration/publisher_confirms_spec.rb +19 -19
- data/spec/higher_level_api/integration/publishing_edge_cases_spec.rb +9 -9
- data/spec/higher_level_api/integration/queue_bind_spec.rb +13 -13
- data/spec/higher_level_api/integration/queue_declare_spec.rb +23 -23
- data/spec/higher_level_api/integration/queue_delete_spec.rb +1 -1
- data/spec/higher_level_api/integration/queue_purge_spec.rb +2 -2
- data/spec/higher_level_api/integration/queue_unbind_spec.rb +2 -2
- data/spec/higher_level_api/integration/read_only_consumer_spec.rb +3 -3
- data/spec/higher_level_api/integration/sender_selected_distribution_spec.rb +4 -4
- data/spec/higher_level_api/integration/tls_connection_spec.rb +5 -5
- data/spec/higher_level_api/integration/with_channel_spec.rb +1 -1
- data/spec/issues/issue100_spec.rb +9 -10
- data/spec/issues/issue141_spec.rb +11 -12
- data/spec/issues/issue224_spec.rb +2 -2
- data/spec/issues/issue78_spec.rb +14 -18
- data/spec/issues/issue83_spec.rb +5 -6
- data/spec/issues/issue97_spec.rb +25 -26
- data/spec/lower_level_api/integration/basic_cancel_spec.rb +15 -16
- data/spec/lower_level_api/integration/basic_consume_spec.rb +19 -20
- data/spec/stress/channel_open_stress_spec.rb +1 -1
- data/spec/stress/channel_open_stress_with_single_threaded_connection_spec.rb +6 -7
- data/spec/stress/concurrent_consumers_stress_spec.rb +6 -7
- data/spec/stress/concurrent_publishers_stress_spec.rb +6 -7
- data/spec/stress/connection_open_close_spec.rb +6 -6
- data/spec/stress/long_running_consumer_spec.rb +6 -7
- data/spec/unit/bunny_spec.rb +5 -5
- data/spec/unit/concurrent/atomic_fixnum_spec.rb +6 -6
- data/spec/unit/concurrent/condition_spec.rb +3 -3
- data/spec/unit/concurrent/linked_continuation_queue_spec.rb +2 -2
- data/spec/unit/concurrent/synchronized_sorted_set_spec.rb +16 -16
- data/spec/unit/system_timer_spec.rb +2 -2
- data/spec/unit/version_delivery_tag_spec.rb +3 -3
- metadata +8 -7
@@ -24,9 +24,9 @@ describe Bunny::Consumer, "#cancel" do
|
|
24
24
|
delivered_data << payload
|
25
25
|
end
|
26
26
|
|
27
|
-
consumer.consumer_tag.
|
27
|
+
expect(consumer.consumer_tag).not_to be_nil
|
28
28
|
cancel_ok = consumer.cancel
|
29
|
-
cancel_ok.consumer_tag.
|
29
|
+
expect(cancel_ok.consumer_tag).to eq consumer.consumer_tag
|
30
30
|
|
31
31
|
ch.close
|
32
32
|
end
|
@@ -37,7 +37,7 @@ describe Bunny::Consumer, "#cancel" do
|
|
37
37
|
ch.default_exchange.publish("", :routing_key => queue_name)
|
38
38
|
|
39
39
|
sleep 0.7
|
40
|
-
delivered_data.
|
40
|
+
expect(delivered_data).to be_empty
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -70,7 +70,7 @@ describe Bunny::Consumer, "#cancel" do
|
|
70
70
|
ch.default_exchange.publish("", :routing_key => queue_name)
|
71
71
|
|
72
72
|
sleep 0.7
|
73
|
-
delivered_data.
|
73
|
+
expect(delivered_data).to be_empty
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|
@@ -35,10 +35,10 @@ describe Bunny::Queue, "#subscribe" do
|
|
35
35
|
x.publish("hello", :routing_key => queue_name)
|
36
36
|
|
37
37
|
sleep 0.7
|
38
|
-
delivered_keys.
|
39
|
-
delivered_data.
|
38
|
+
expect(delivered_keys).to include(queue_name)
|
39
|
+
expect(delivered_data).to include("hello")
|
40
40
|
|
41
|
-
ch.queue(queue_name, :auto_delete => true, :durable => false).message_count.
|
41
|
+
expect(ch.queue(queue_name, :auto_delete => true, :durable => false).message_count).to eq 0
|
42
42
|
|
43
43
|
ch.close
|
44
44
|
end
|
@@ -63,9 +63,9 @@ describe Bunny::Queue, "#subscribe" do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
sleep 1.0
|
66
|
-
delivery_tags.
|
66
|
+
expect(delivery_tags).to eq SortedSet.new(Range.new(1, 100).to_a)
|
67
67
|
|
68
|
-
ch.queue(queue_name, :auto_delete => true, :durable => false).message_count.
|
68
|
+
expect(ch.queue(queue_name, :auto_delete => true, :durable => false).message_count).to eq 0
|
69
69
|
|
70
70
|
ch.close
|
71
71
|
end
|
@@ -95,9 +95,9 @@ describe Bunny::Queue, "#subscribe" do
|
|
95
95
|
end
|
96
96
|
|
97
97
|
sleep 1.5
|
98
|
-
delivery_tags.
|
98
|
+
expect(delivery_tags).to eq SortedSet.new(Range.new(1, 100).to_a)
|
99
99
|
|
100
|
-
ch.queue(queue_name, :auto_delete => true, :durable => false).message_count.
|
100
|
+
expect(ch.queue(queue_name, :auto_delete => true, :durable => false).message_count).to eq 0
|
101
101
|
|
102
102
|
ch.close
|
103
103
|
end
|
@@ -129,10 +129,10 @@ describe Bunny::Queue, "#subscribe" do
|
|
129
129
|
x.publish("hello", :routing_key => queue_name)
|
130
130
|
|
131
131
|
sleep 0.7
|
132
|
-
delivered_keys.
|
133
|
-
delivered_data.
|
132
|
+
expect(delivered_keys).to include(queue_name)
|
133
|
+
expect(delivered_data).to include("hello")
|
134
134
|
|
135
|
-
ch.queue(queue_name, :auto_delete => true, :durable => false).message_count.
|
135
|
+
expect(ch.queue(queue_name, :auto_delete => true, :durable => false).message_count).to eq 0
|
136
136
|
|
137
137
|
ch.close
|
138
138
|
end
|
@@ -154,7 +154,7 @@ describe Bunny::Queue, "#subscribe" do
|
|
154
154
|
end
|
155
155
|
|
156
156
|
sleep 0.7
|
157
|
-
q.message_count.
|
157
|
+
expect(q.message_count).to be > 50
|
158
158
|
|
159
159
|
t = Thread.new do
|
160
160
|
ch = connection.create_channel
|
@@ -167,10 +167,10 @@ describe Bunny::Queue, "#subscribe" do
|
|
167
167
|
t.abort_on_exception = true
|
168
168
|
sleep 0.5
|
169
169
|
|
170
|
-
delivered_keys.
|
171
|
-
delivered_data.
|
170
|
+
expect(delivered_keys).to include(queue_name)
|
171
|
+
expect(delivered_data).to include("hello")
|
172
172
|
|
173
|
-
ch.queue(queue_name, :auto_delete => true, :durable => false).message_count.
|
173
|
+
expect(ch.queue(queue_name, :auto_delete => true, :durable => false).message_count).to eq 0
|
174
174
|
|
175
175
|
ch.close
|
176
176
|
end
|
@@ -212,10 +212,10 @@ describe Bunny::Queue, "#subscribe" do
|
|
212
212
|
x.publish("hello", :routing_key => queue_name)
|
213
213
|
|
214
214
|
sleep 0.7
|
215
|
-
delivered_keys.
|
216
|
-
delivered_data.
|
215
|
+
expect(delivered_keys).to include(queue_name)
|
216
|
+
expect(delivered_data).to include("hello")
|
217
217
|
|
218
|
-
ch.queue(queue_name).message_count.
|
218
|
+
expect(ch.queue(queue_name).message_count).to eq 0
|
219
219
|
|
220
220
|
ch.queue_delete(queue_name)
|
221
221
|
ch.close
|
@@ -249,7 +249,7 @@ describe Bunny::Queue, "#subscribe" do
|
|
249
249
|
x.publish("hello", :routing_key => queue_name)
|
250
250
|
sleep 0.5
|
251
251
|
|
252
|
-
caught.message.
|
252
|
+
expect(caught.message).to eq queue_name
|
253
253
|
|
254
254
|
ch.close
|
255
255
|
end
|
@@ -301,9 +301,9 @@ describe Bunny::Queue, "#subscribe" do
|
|
301
301
|
end
|
302
302
|
|
303
303
|
sleep 1.0
|
304
|
-
delivery_tags.
|
304
|
+
expect(delivery_tags).to eq SortedSet.new(Range.new(1, 100).to_a)
|
305
305
|
|
306
|
-
ch.queue(queue_name, :auto_delete => true, :durable => false).message_count.
|
306
|
+
expect(ch.queue(queue_name, :auto_delete => true, :durable => false).message_count).to eq 0
|
307
307
|
|
308
308
|
ch.close
|
309
309
|
end
|
@@ -333,9 +333,9 @@ describe Bunny::Queue, "#subscribe" do
|
|
333
333
|
end
|
334
334
|
|
335
335
|
sleep 1.5
|
336
|
-
delivery_tags.
|
336
|
+
expect(delivery_tags).to eq SortedSet.new(Range.new(1, 100).to_a)
|
337
337
|
|
338
|
-
ch.queue(queue_name, :auto_delete => true, :durable => false).message_count.
|
338
|
+
expect(ch.queue(queue_name, :auto_delete => true, :durable => false).message_count).to eq 0
|
339
339
|
|
340
340
|
ch.close
|
341
341
|
end
|
@@ -30,7 +30,7 @@ describe Bunny::Queue, "#pop" do
|
|
30
30
|
expect(get_ok.routing_key).to eq(q.name)
|
31
31
|
expect(get_ok.delivery_tag).to be_kind_of(Bunny::VersionedDeliveryTag)
|
32
32
|
expect(content).to eq(msg)
|
33
|
-
q.message_count.
|
33
|
+
expect(q.message_count).to eq 0
|
34
34
|
|
35
35
|
ch.close
|
36
36
|
end
|
@@ -48,7 +48,7 @@ describe Bunny::Queue, "#pop" do
|
|
48
48
|
expect(get_empty).to eq(nil)
|
49
49
|
expect(properties).to eq(nil)
|
50
50
|
expect(content).to eq(nil)
|
51
|
-
q.message_count.
|
51
|
+
expect(q.message_count).to eq 0
|
52
52
|
|
53
53
|
ch.close
|
54
54
|
end
|
@@ -22,12 +22,12 @@ describe Bunny::Channel, "#nack" do
|
|
22
22
|
|
23
23
|
x.publish("bunneth", :routing_key => q.name)
|
24
24
|
sleep(0.5)
|
25
|
-
q.message_count.
|
25
|
+
expect(q.message_count).to eq 1
|
26
26
|
delivery_info, _, content = q.pop(:manual_ack => true)
|
27
27
|
|
28
28
|
subject.nack(delivery_info.delivery_tag, false, false)
|
29
29
|
sleep(0.5)
|
30
|
-
q.message_count.
|
30
|
+
expect(q.message_count).to eq 0
|
31
31
|
|
32
32
|
subject.close
|
33
33
|
end
|
@@ -42,14 +42,14 @@ q = subject.queue("bunny.basic.nack.with-requeue-true-multi-true", :exclusive =>
|
|
42
42
|
x.publish("bunneth", :routing_key => q.name)
|
43
43
|
end
|
44
44
|
sleep(0.5)
|
45
|
-
q.message_count.
|
45
|
+
expect(q.message_count).to eq 3
|
46
46
|
_, _, _ = q.pop(:manual_ack => true)
|
47
47
|
_, _, _ = q.pop(:manual_ack => true)
|
48
48
|
delivery_info, _, content = q.pop(:manual_ack => true)
|
49
49
|
|
50
50
|
subject.nack(delivery_info.delivery_tag, true, true)
|
51
51
|
sleep(0.5)
|
52
|
-
q.message_count.
|
52
|
+
expect(q.message_count).to eq 3
|
53
53
|
|
54
54
|
subject.close
|
55
55
|
end
|
@@ -63,7 +63,7 @@ q = subject.queue("bunny.basic.nack.with-requeue-true-multi-true", :exclusive =>
|
|
63
63
|
|
64
64
|
x.publish("bunneth", :routing_key => q.name)
|
65
65
|
sleep(0.25)
|
66
|
-
q.message_count.
|
66
|
+
expect(q.message_count).to eq 1
|
67
67
|
_, _, content = q.pop(:manual_ack => true)
|
68
68
|
|
69
69
|
subject.on_error do |ch, channel_close|
|
@@ -73,7 +73,7 @@ q = subject.queue("bunny.basic.nack.with-requeue-true-multi-true", :exclusive =>
|
|
73
73
|
|
74
74
|
sleep 0.5
|
75
75
|
|
76
|
-
@channel_close.reply_text.
|
76
|
+
expect(@channel_close.reply_text).to eq "PRECONDITION_FAILED - unknown delivery tag 82"
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
@@ -15,7 +15,7 @@ if RUBY_VERSION <= "1.9"
|
|
15
15
|
|
16
16
|
context "with all default delivery and message properties" do
|
17
17
|
it "routes messages to a queue with the same name as the routing key" do
|
18
|
-
connection.
|
18
|
+
expect(connection).to be_threaded
|
19
19
|
ch = connection.create_channel
|
20
20
|
|
21
21
|
q = ch.queue("", :exclusive => true)
|
@@ -27,7 +27,7 @@ if RUBY_VERSION <= "1.9"
|
|
27
27
|
publish("xyzzy", :routing_key => q.name)
|
28
28
|
|
29
29
|
sleep(1)
|
30
|
-
q.message_count.
|
30
|
+
expect(q.message_count).to eq 4
|
31
31
|
|
32
32
|
ch.close
|
33
33
|
end
|
@@ -36,7 +36,7 @@ if RUBY_VERSION <= "1.9"
|
|
36
36
|
|
37
37
|
context "with all default delivery and message properties" do
|
38
38
|
it "routes the messages and preserves all the metadata" do
|
39
|
-
connection.
|
39
|
+
expect(connection).to be_threaded
|
40
40
|
ch = connection.create_channel
|
41
41
|
|
42
42
|
q = ch.queue("", :exclusive => true)
|
@@ -45,15 +45,15 @@ if RUBY_VERSION <= "1.9"
|
|
45
45
|
x.publish("xyzzy", :routing_key => q.name, :persistent => true)
|
46
46
|
|
47
47
|
sleep(1)
|
48
|
-
q.message_count.
|
48
|
+
expect(q.message_count).to eq 1
|
49
49
|
|
50
50
|
envelope, headers, payload = q.pop
|
51
51
|
|
52
|
-
payload.
|
52
|
+
expect(payload).to eq "xyzzy"
|
53
53
|
|
54
|
-
headers[:content_type].
|
55
|
-
headers[:delivery_mode].
|
56
|
-
headers[:priority].
|
54
|
+
expect(headers[:content_type]).to eq "application/octet-stream"
|
55
|
+
expect(headers[:delivery_mode]).to eq 2
|
56
|
+
expect(headers[:priority]).to eq 0
|
57
57
|
|
58
58
|
ch.close
|
59
59
|
end
|
@@ -68,7 +68,7 @@ if RUBY_VERSION <= "1.9"
|
|
68
68
|
end
|
69
69
|
|
70
70
|
it "routes messages to a queue with the same name as the routing key" do
|
71
|
-
connection.
|
71
|
+
expect(connection).not_to be_threaded
|
72
72
|
ch = connection.create_channel
|
73
73
|
|
74
74
|
q = ch.queue("", :exclusive => true)
|
@@ -80,7 +80,7 @@ if RUBY_VERSION <= "1.9"
|
|
80
80
|
publish("xyzzy", :routing_key => q.name)
|
81
81
|
|
82
82
|
sleep(1)
|
83
|
-
q.message_count.
|
83
|
+
expect(q.message_count).to eq 4
|
84
84
|
|
85
85
|
ch.close
|
86
86
|
end
|
@@ -112,11 +112,11 @@ describe "Published message" do
|
|
112
112
|
x.publish("xyzzy", :routing_key => rk, :persistent => true)
|
113
113
|
|
114
114
|
sleep(1)
|
115
|
-
q.message_count.
|
115
|
+
expect(q.message_count).to eq 1
|
116
116
|
|
117
117
|
_, _, payload = q.pop
|
118
118
|
|
119
|
-
payload.
|
119
|
+
expect(payload).to eq "xyzzy"
|
120
120
|
|
121
121
|
ch.close
|
122
122
|
end
|
@@ -134,11 +134,11 @@ describe "Published message" do
|
|
134
134
|
x.publish("xyzzy", :routing_key => rk, :persistent => true)
|
135
135
|
|
136
136
|
sleep(1)
|
137
|
-
q.message_count.
|
137
|
+
expect(q.message_count).to eq 1
|
138
138
|
|
139
139
|
_, _, payload = q.pop
|
140
140
|
|
141
|
-
payload.
|
141
|
+
expect(payload).to eq "xyzzy"
|
142
142
|
|
143
143
|
ch.close
|
144
144
|
end
|
@@ -11,10 +11,19 @@ describe Bunny::Channel, "#prefetch" do
|
|
11
11
|
connection.close
|
12
12
|
end
|
13
13
|
|
14
|
-
context "with a positive integer" do
|
14
|
+
context "with a positive integer < 65535" do
|
15
15
|
it "sets that prefetch level via basic.qos" do
|
16
16
|
ch = connection.create_channel
|
17
|
-
ch.prefetch(10).
|
17
|
+
expect(ch.prefetch(10)).to be_instance_of(AMQ::Protocol::Basic::QosOk)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
context "with a positive integer > 65535" do
|
22
|
+
it "raises an ArgumentError" do
|
23
|
+
ch = connection.create_channel
|
24
|
+
expect {
|
25
|
+
ch.prefetch(100_000)
|
26
|
+
}.to raise_error(ArgumentError)
|
18
27
|
end
|
19
28
|
end
|
20
29
|
|
@@ -12,7 +12,7 @@ describe Bunny::Channel, "#recover" do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it "is supported" do
|
15
|
-
subject.recover(true).
|
16
|
-
subject.recover(true).
|
15
|
+
expect(subject.recover(true)).to be_instance_of(AMQ::Protocol::Basic::RecoverOk)
|
16
|
+
expect(subject.recover(true)).to be_instance_of(AMQ::Protocol::Basic::RecoverOk)
|
17
17
|
end
|
18
18
|
end
|
@@ -19,12 +19,12 @@ describe Bunny::Channel, "#reject" do
|
|
19
19
|
|
20
20
|
x.publish("bunneth", :routing_key => q.name)
|
21
21
|
sleep(0.5)
|
22
|
-
q.message_count.
|
22
|
+
expect(q.message_count).to eq 1
|
23
23
|
delivery_info, _, _ = q.pop(:manual_ack => true)
|
24
24
|
|
25
25
|
ch.reject(delivery_info.delivery_tag, true)
|
26
26
|
sleep(0.5)
|
27
|
-
q.message_count.
|
27
|
+
expect(q.message_count).to eq 1
|
28
28
|
|
29
29
|
ch.close
|
30
30
|
end
|
@@ -38,12 +38,12 @@ describe Bunny::Channel, "#reject" do
|
|
38
38
|
|
39
39
|
x.publish("bunneth", :routing_key => q.name)
|
40
40
|
sleep(0.5)
|
41
|
-
q.message_count.
|
41
|
+
expect(q.message_count).to eq 1
|
42
42
|
delivery_info, _, _ = q.pop(:manual_ack => true)
|
43
43
|
|
44
44
|
ch.reject(delivery_info.delivery_tag, false)
|
45
45
|
sleep(0.5)
|
46
|
-
q.message_count.
|
46
|
+
expect(q.message_count).to eq 0
|
47
47
|
|
48
48
|
ch.close
|
49
49
|
end
|
@@ -58,7 +58,7 @@ describe Bunny::Channel, "#reject" do
|
|
58
58
|
|
59
59
|
x.publish("bunneth", :routing_key => q.name)
|
60
60
|
sleep(0.25)
|
61
|
-
q.message_count.
|
61
|
+
expect(q.message_count).to eq 1
|
62
62
|
_, _, content = q.pop(:manual_ack => true)
|
63
63
|
|
64
64
|
ch.on_error do |ch, channel_close|
|
@@ -68,7 +68,7 @@ describe Bunny::Channel, "#reject" do
|
|
68
68
|
|
69
69
|
sleep 0.5
|
70
70
|
|
71
|
-
@channel_close.reply_text.
|
71
|
+
expect(@channel_close.reply_text).to eq "PRECONDITION_FAILED - unknown delivery tag 82"
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
@@ -15,9 +15,9 @@ describe Bunny::Channel, "when closed" do
|
|
15
15
|
ch = connection.create_channel
|
16
16
|
n = ch.number
|
17
17
|
|
18
|
-
ch.
|
18
|
+
expect(ch).to be_open
|
19
19
|
ch.close
|
20
|
-
ch.
|
20
|
+
expect(ch).to be_closed
|
21
21
|
|
22
22
|
# a new channel with the same id can be created
|
23
23
|
connection.create_channel(n)
|
@@ -13,17 +13,17 @@ describe Bunny::Channel, "when opened" do
|
|
13
13
|
|
14
14
|
context "without explicitly provided id" do
|
15
15
|
it "gets an allocated id and is successfully opened" do
|
16
|
-
connection.
|
16
|
+
expect(connection).to be_connected
|
17
17
|
ch = connection.create_channel
|
18
|
-
ch.
|
18
|
+
expect(ch).to be_open
|
19
19
|
|
20
|
-
ch.id.
|
20
|
+
expect(ch.id).to be > 0
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
context "with an explicitly provided id = 0" do
|
25
25
|
it "raises ArgumentError" do
|
26
|
-
connection.
|
26
|
+
expect(connection).to be_connected
|
27
27
|
expect {
|
28
28
|
connection.create_channel(0)
|
29
29
|
}.to raise_error(ArgumentError)
|
@@ -34,10 +34,10 @@ describe Bunny::Channel, "when opened" do
|
|
34
34
|
context "with explicitly provided id" do
|
35
35
|
it "uses that id and is successfully opened" do
|
36
36
|
ch = connection.create_channel(767)
|
37
|
-
connection.
|
38
|
-
ch.
|
37
|
+
expect(connection).to be_connected
|
38
|
+
expect(ch).to be_open
|
39
39
|
|
40
|
-
ch.id.
|
40
|
+
expect(ch.id).to eq 767
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -46,12 +46,12 @@ describe Bunny::Channel, "when opened" do
|
|
46
46
|
context "with explicitly provided id that is already taken" do
|
47
47
|
it "reuses the channel that is already opened" do
|
48
48
|
ch = connection.create_channel(767)
|
49
|
-
connection.
|
50
|
-
ch.
|
49
|
+
expect(connection).to be_connected
|
50
|
+
expect(ch).to be_open
|
51
51
|
|
52
|
-
ch.id.
|
52
|
+
expect(ch.id).to eq 767
|
53
53
|
|
54
|
-
connection.create_channel(767).
|
54
|
+
expect(connection.create_channel(767)).to eq ch
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|