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.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/CONTRIBUTING.md +14 -0
  4. data/ChangeLog.md +21 -6
  5. data/Gemfile +1 -1
  6. data/LICENSE +1 -1
  7. data/README.md +22 -23
  8. data/bunny.gemspec +1 -1
  9. data/lib/bunny/channel.rb +12 -0
  10. data/lib/bunny/concurrent/continuation_queue.rb +30 -13
  11. data/lib/bunny/exchange.rb +0 -5
  12. data/lib/bunny/jruby/socket.rb +1 -2
  13. data/lib/bunny/queue.rb +9 -0
  14. data/lib/bunny/session.rb +7 -6
  15. data/lib/bunny/version.rb +1 -1
  16. data/spec/higher_level_api/integration/basic_ack_spec.rb +9 -9
  17. data/spec/higher_level_api/integration/basic_cancel_spec.rb +4 -4
  18. data/spec/higher_level_api/integration/basic_consume_spec.rb +22 -22
  19. data/spec/higher_level_api/integration/basic_consume_with_objects_spec.rb +1 -1
  20. data/spec/higher_level_api/integration/basic_get_spec.rb +2 -2
  21. data/spec/higher_level_api/integration/basic_nack_spec.rb +6 -6
  22. data/spec/higher_level_api/integration/basic_publish_spec.rb +14 -14
  23. data/spec/higher_level_api/integration/basic_qos_spec.rb +11 -2
  24. data/spec/higher_level_api/integration/basic_recover_spec.rb +2 -2
  25. data/spec/higher_level_api/integration/basic_reject_spec.rb +6 -6
  26. data/spec/higher_level_api/integration/basic_return_spec.rb +1 -1
  27. data/spec/higher_level_api/integration/channel_close_spec.rb +2 -2
  28. data/spec/higher_level_api/integration/channel_open_spec.rb +11 -11
  29. data/spec/higher_level_api/integration/connection_recovery_spec.rb +52 -52
  30. data/spec/higher_level_api/integration/connection_spec.rb +83 -83
  31. data/spec/higher_level_api/integration/connection_stop_spec.rb +11 -11
  32. data/spec/higher_level_api/integration/consistent_hash_exchange_spec.rb +2 -2
  33. data/spec/higher_level_api/integration/consumer_cancellation_notification_spec.rb +3 -3
  34. data/spec/higher_level_api/integration/dead_lettering_spec.rb +6 -6
  35. data/spec/higher_level_api/integration/exchange_bind_spec.rb +1 -1
  36. data/spec/higher_level_api/integration/exchange_declare_spec.rb +20 -20
  37. data/spec/higher_level_api/integration/exchange_delete_spec.rb +11 -11
  38. data/spec/higher_level_api/integration/exchange_unbind_spec.rb +2 -2
  39. data/spec/higher_level_api/integration/merry_go_round_spec.rb +2 -2
  40. data/spec/higher_level_api/integration/message_properties_access_spec.rb +27 -27
  41. data/spec/higher_level_api/integration/predeclared_exchanges_spec.rb +1 -1
  42. data/spec/higher_level_api/integration/publisher_confirms_spec.rb +19 -19
  43. data/spec/higher_level_api/integration/publishing_edge_cases_spec.rb +9 -9
  44. data/spec/higher_level_api/integration/queue_bind_spec.rb +13 -13
  45. data/spec/higher_level_api/integration/queue_declare_spec.rb +23 -23
  46. data/spec/higher_level_api/integration/queue_delete_spec.rb +1 -1
  47. data/spec/higher_level_api/integration/queue_purge_spec.rb +2 -2
  48. data/spec/higher_level_api/integration/queue_unbind_spec.rb +2 -2
  49. data/spec/higher_level_api/integration/read_only_consumer_spec.rb +3 -3
  50. data/spec/higher_level_api/integration/sender_selected_distribution_spec.rb +4 -4
  51. data/spec/higher_level_api/integration/tls_connection_spec.rb +5 -5
  52. data/spec/higher_level_api/integration/with_channel_spec.rb +1 -1
  53. data/spec/issues/issue100_spec.rb +9 -10
  54. data/spec/issues/issue141_spec.rb +11 -12
  55. data/spec/issues/issue224_spec.rb +2 -2
  56. data/spec/issues/issue78_spec.rb +14 -18
  57. data/spec/issues/issue83_spec.rb +5 -6
  58. data/spec/issues/issue97_spec.rb +25 -26
  59. data/spec/lower_level_api/integration/basic_cancel_spec.rb +15 -16
  60. data/spec/lower_level_api/integration/basic_consume_spec.rb +19 -20
  61. data/spec/stress/channel_open_stress_spec.rb +1 -1
  62. data/spec/stress/channel_open_stress_with_single_threaded_connection_spec.rb +6 -7
  63. data/spec/stress/concurrent_consumers_stress_spec.rb +6 -7
  64. data/spec/stress/concurrent_publishers_stress_spec.rb +6 -7
  65. data/spec/stress/connection_open_close_spec.rb +6 -6
  66. data/spec/stress/long_running_consumer_spec.rb +6 -7
  67. data/spec/unit/bunny_spec.rb +5 -5
  68. data/spec/unit/concurrent/atomic_fixnum_spec.rb +6 -6
  69. data/spec/unit/concurrent/condition_spec.rb +3 -3
  70. data/spec/unit/concurrent/linked_continuation_queue_spec.rb +2 -2
  71. data/spec/unit/concurrent/synchronized_sorted_set_spec.rb +16 -16
  72. data/spec/unit/system_timer_spec.rb +2 -2
  73. data/spec/unit/version_delivery_tag_spec.rb +3 -3
  74. metadata +8 -7
@@ -57,7 +57,7 @@ unless ENV["CI"]
57
57
  x = ch.default_exchange
58
58
  x.publish("msg", :routing_key => q.name)
59
59
  sleep 0.5
60
- q.message_count.should == 1
60
+ expect(q.message_count).to eq 1
61
61
  q.purge
62
62
  end
63
63
 
@@ -65,7 +65,7 @@ unless ENV["CI"]
65
65
  q.purge
66
66
  x.publish("msg", :routing_key => routing_key)
67
67
  sleep 0.5
68
- q.message_count.should == 1
68
+ expect(q.message_count).to eq 1
69
69
  q.purge
70
70
  end
71
71
 
@@ -74,7 +74,7 @@ unless ENV["CI"]
74
74
  q.bind(destination, :routing_key => routing_key)
75
75
 
76
76
  source.publish("msg", :routing_key => routing_key)
77
- q.message_count.should == 1
77
+ expect(q.message_count).to eq 1
78
78
  q.delete
79
79
  end
80
80
 
@@ -86,10 +86,10 @@ unless ENV["CI"]
86
86
  with_open do |c|
87
87
  close_all_connections!
88
88
  sleep 0.1
89
- c.should_not be_open
89
+ expect(c).not_to be_open
90
90
 
91
91
  wait_for_recovery
92
- c.should be_open
92
+ expect(c).to be_open
93
93
  end
94
94
  end
95
95
 
@@ -97,10 +97,10 @@ unless ENV["CI"]
97
97
  with_open_multi_host do |c|
98
98
  close_all_connections!
99
99
  sleep 0.1
100
- c.should_not be_open
100
+ expect(c).not_to be_open
101
101
 
102
102
  wait_for_recovery
103
- c.should be_open
103
+ expect(c).to be_open
104
104
  end
105
105
  end
106
106
 
@@ -108,10 +108,10 @@ unless ENV["CI"]
108
108
  with_open_multi_broken_host do |c|
109
109
  close_all_connections!
110
110
  sleep 0.1
111
- c.should_not be_open
111
+ expect(c).not_to be_open
112
112
 
113
113
  wait_for_recovery
114
- c.should be_open
114
+ expect(c).to be_open
115
115
  end
116
116
  end
117
117
 
@@ -121,11 +121,11 @@ unless ENV["CI"]
121
121
  ch2 = c.create_channel
122
122
  close_all_connections!
123
123
  sleep 0.1
124
- c.should_not be_open
124
+ expect(c).not_to be_open
125
125
 
126
126
  wait_for_recovery
127
- ch1.should be_open
128
- ch2.should be_open
127
+ expect(ch1).to be_open
128
+ expect(ch2).to be_open
129
129
  end
130
130
  end
131
131
 
@@ -135,11 +135,11 @@ unless ENV["CI"]
135
135
  ch2 = c.create_channel
136
136
  close_all_connections!
137
137
  sleep 0.1
138
- c.should_not be_open
138
+ expect(c).not_to be_open
139
139
 
140
140
  wait_for_recovery
141
- ch1.should be_open
142
- ch2.should be_open
141
+ expect(ch1).to be_open
142
+ expect(ch2).to be_open
143
143
  end
144
144
  end
145
145
 
@@ -149,11 +149,11 @@ unless ENV["CI"]
149
149
  ch2 = c.create_channel
150
150
  close_all_connections!
151
151
  sleep 0.1
152
- c.should_not be_open
152
+ expect(c).not_to be_open
153
153
 
154
154
  wait_for_recovery
155
- ch1.should be_open
156
- ch2.should be_open
155
+ expect(ch1).to be_open
156
+ expect(ch2).to be_open
157
157
  end
158
158
  end
159
159
 
@@ -161,14 +161,14 @@ unless ENV["CI"]
161
161
  with_open do |c|
162
162
  ch = c.create_channel
163
163
  ch.prefetch(11)
164
- ch.prefetch_count.should == 11
164
+ expect(ch.prefetch_count).to eq 11
165
165
  close_all_connections!
166
166
  sleep 0.1
167
- c.should_not be_open
167
+ expect(c).not_to be_open
168
168
 
169
169
  wait_for_recovery
170
- ch.should be_open
171
- ch.prefetch_count.should == 11
170
+ expect(ch).to be_open
171
+ expect(ch.prefetch_count).to eq 11
172
172
  end
173
173
  end
174
174
 
@@ -177,14 +177,14 @@ unless ENV["CI"]
177
177
  with_open do |c|
178
178
  ch = c.create_channel
179
179
  ch.confirm_select
180
- ch.should be_using_publisher_confirms
180
+ expect(ch).to be_using_publisher_confirms
181
181
  close_all_connections!
182
182
  sleep 0.1
183
- c.should_not be_open
183
+ expect(c).not_to be_open
184
184
 
185
185
  wait_for_recovery
186
- ch.should be_open
187
- ch.should be_using_publisher_confirms
186
+ expect(ch).to be_open
187
+ expect(ch).to be_using_publisher_confirms
188
188
  end
189
189
  end
190
190
 
@@ -192,14 +192,14 @@ unless ENV["CI"]
192
192
  with_open do |c|
193
193
  ch = c.create_channel
194
194
  ch.tx_select
195
- ch.should be_using_tx
195
+ expect(ch).to be_using_tx
196
196
  close_all_connections!
197
197
  sleep 0.1
198
- c.should_not be_open
198
+ expect(c).not_to be_open
199
199
 
200
200
  wait_for_recovery
201
- ch.should be_open
202
- ch.should be_using_tx
201
+ expect(ch).to be_open
202
+ expect(ch).to be_using_tx
203
203
  end
204
204
  end
205
205
 
@@ -209,10 +209,10 @@ unless ENV["CI"]
209
209
  q = ch.queue("bunny.tests.recovery.client-named#{rand}")
210
210
  close_all_connections!
211
211
  sleep 0.1
212
- c.should_not be_open
212
+ expect(c).not_to be_open
213
213
 
214
214
  wait_for_recovery
215
- ch.should be_open
215
+ expect(ch).to be_open
216
216
  ensure_queue_recovery(ch, q)
217
217
  q.delete
218
218
  end
@@ -225,10 +225,10 @@ unless ENV["CI"]
225
225
  q = ch.queue("", :exclusive => true)
226
226
  close_all_connections!
227
227
  sleep 0.1
228
- c.should_not be_open
228
+ expect(c).not_to be_open
229
229
 
230
230
  wait_for_recovery
231
- ch.should be_open
231
+ expect(ch).to be_open
232
232
  ensure_queue_recovery(ch, q)
233
233
  end
234
234
  end
@@ -241,10 +241,10 @@ unless ENV["CI"]
241
241
  q.bind(x)
242
242
  close_all_connections!
243
243
  sleep 0.1
244
- c.should_not be_open
244
+ expect(c).not_to be_open
245
245
 
246
246
  wait_for_recovery
247
- ch.should be_open
247
+ expect(ch).to be_open
248
248
  ensure_queue_binding_recovery(x, q)
249
249
  end
250
250
  end
@@ -257,10 +257,10 @@ unless ENV["CI"]
257
257
  x2.bind(x)
258
258
  close_all_connections!
259
259
  sleep 0.1
260
- c.should_not be_open
260
+ expect(c).not_to be_open
261
261
 
262
262
  wait_for_recovery
263
- ch.should be_open
263
+ expect(ch).to be_open
264
264
  ensure_exchange_binding_recovery(ch, x, x2)
265
265
  end
266
266
  end
@@ -269,20 +269,20 @@ unless ENV["CI"]
269
269
  with_open do |c|
270
270
  q = "queue#{Time.now.to_i}"
271
271
  10.times { c.create_channel }
272
- c.queue_exists?(q).should be_false
272
+ expect(c.queue_exists?(q)).to eq false
273
273
  close_all_connections!
274
274
  sleep 0.1
275
- c.should_not be_open
275
+ expect(c).not_to be_open
276
276
 
277
277
  wait_for_recovery
278
- c.queue_exists?(q).should be_false
278
+ expect(c.queue_exists?(q)).to eq false
279
279
  # make sure the connection isn't closed shortly after
280
280
  # due to "second 'channel.open' seen". MK.
281
- c.should be_open
281
+ expect(c).to be_open
282
282
  sleep 0.1
283
- c.should be_open
283
+ expect(c).to be_open
284
284
  sleep 0.1
285
- c.should be_open
285
+ expect(c).to be_open
286
286
  end
287
287
  end
288
288
 
@@ -297,14 +297,14 @@ unless ENV["CI"]
297
297
  end
298
298
  close_all_connections!
299
299
  sleep 0.1
300
- c.should_not be_open
300
+ expect(c).not_to be_open
301
301
 
302
302
  wait_for_recovery
303
- ch.should be_open
303
+ expect(ch).to be_open
304
304
 
305
305
  q.publish("")
306
306
  sleep 0.5
307
- expect(delivered).to be_true
307
+ expect(delivered).to eq true
308
308
  end
309
309
  end
310
310
 
@@ -321,12 +321,12 @@ unless ENV["CI"]
321
321
  end
322
322
  close_all_connections!
323
323
  sleep 0.1
324
- c.should_not be_open
324
+ expect(c).not_to be_open
325
325
 
326
326
  wait_for_recovery
327
- ch.should be_open
327
+ expect(ch).to be_open
328
328
 
329
- q.consumer_count.should == n
329
+ expect(q.consumer_count).to eq n
330
330
  end
331
331
  end
332
332
 
@@ -343,10 +343,10 @@ unless ENV["CI"]
343
343
  end
344
344
  close_all_connections!
345
345
  sleep 0.1
346
- c.should_not be_open
346
+ expect(c).not_to be_open
347
347
 
348
348
  wait_for_recovery
349
- ch.should be_open
349
+ expect(ch).to be_open
350
350
 
351
351
  qs.each do |q|
352
352
  ch.queue_declare(q.name, :passive => true)
@@ -24,10 +24,10 @@ describe Bunny::Session do
24
24
  session = described_class.new("amqp://127.0.0.1")
25
25
  session.start
26
26
 
27
- session.vhost.should == "/"
28
- session.host.should == "127.0.0.1"
29
- session.port.should == 5672
30
- session.ssl?.should be_false
27
+ expect(session.vhost).to eq "/"
28
+ expect(session.host).to eq "127.0.0.1"
29
+ expect(session.port).to eq 5672
30
+ expect(session.ssl?).to eq false
31
31
 
32
32
  session.close
33
33
  end
@@ -37,15 +37,15 @@ describe Bunny::Session do
37
37
  it "parses vhost as an empty string" do
38
38
  session = described_class.new("amqp://127.0.0.1/")
39
39
 
40
- session.hostname.should == "127.0.0.1"
41
- session.port.should == 5672
42
- session.vhost.should == ""
40
+ expect(session.hostname).to eq "127.0.0.1"
41
+ expect(session.port).to eq 5672
42
+ expect(session.vhost).to eq ""
43
43
  end
44
44
  end
45
45
 
46
46
  context "when URI is amqp://dev.rabbitmq.com/a/path/with/slashes" do
47
47
  it "raises an ArgumentError" do
48
- lambda { described_class.new("amqp://dev.rabbitmq.com/a/path/with/slashes") }.should raise_error(ArgumentError)
48
+ expect { described_class.new("amqp://dev.rabbitmq.com/a/path/with/slashes") }.to raise_error(ArgumentError)
49
49
  end
50
50
  end
51
51
  end
@@ -57,7 +57,7 @@ describe Bunny::Session do
57
57
  it "provides a way to fine tune socket options" do
58
58
  conn = Bunny.new
59
59
  conn.start
60
- conn.transport.socket.should respond_to(:setsockopt)
60
+ expect(conn.transport.socket).to respond_to(:setsockopt)
61
61
 
62
62
  conn.close
63
63
  end
@@ -65,16 +65,16 @@ describe Bunny::Session do
65
65
  it "successfully negotiates the connection" do
66
66
  conn = Bunny.new
67
67
  conn.start
68
- conn.should be_connected
68
+ expect(conn).to be_connected
69
69
 
70
- conn.server_properties.should_not be_nil
71
- conn.server_capabilities.should_not be_nil
70
+ expect(conn.server_properties).not_to be_nil
71
+ expect(conn.server_capabilities).not_to be_nil
72
72
 
73
73
  props = conn.server_properties
74
74
 
75
- props["product"].should_not be_nil
76
- props["platform"].should_not be_nil
77
- props["version"].should_not be_nil
75
+ expect(props["product"]).not_to be_nil
76
+ expect(props["platform"]).not_to be_nil
77
+ expect(props["version"]).not_to be_nil
78
78
 
79
79
  conn.close
80
80
  end
@@ -85,16 +85,16 @@ describe Bunny::Session do
85
85
  it "successfully connects" do
86
86
  conn = described_class.new(:connection_timeout => 5)
87
87
  conn.start
88
- conn.should be_connected
88
+ expect(conn).to be_connected
89
89
 
90
- conn.server_properties.should_not be_nil
91
- conn.server_capabilities.should_not be_nil
90
+ expect(conn.server_properties).not_to be_nil
91
+ expect(conn.server_capabilities).not_to be_nil
92
92
 
93
93
  props = conn.server_properties
94
94
 
95
- props["product"].should_not be_nil
96
- props["platform"].should_not be_nil
97
- props["version"].should_not be_nil
95
+ expect(props["product"]).not_to be_nil
96
+ expect(props["platform"]).not_to be_nil
97
+ expect(props["version"]).not_to be_nil
98
98
 
99
99
  conn.close
100
100
  end
@@ -111,16 +111,16 @@ describe Bunny::Session do
111
111
  end
112
112
 
113
113
  it "uses hostname = 127.0.0.1" do
114
- subject.host.should == host
115
- subject.hostname.should == host
114
+ expect(subject.host).to eq host
115
+ expect(subject.hostname).to eq host
116
116
  end
117
117
 
118
118
  it "uses port 5672" do
119
- subject.port.should == port
119
+ expect(subject.port).to eq port
120
120
  end
121
121
 
122
122
  it "uses username = guest" do
123
- subject.username.should == username
123
+ expect(subject.username).to eq username
124
124
  end
125
125
  end
126
126
 
@@ -133,17 +133,17 @@ describe Bunny::Session do
133
133
  let(:subject) { described_class.new(:hostname => host) }
134
134
 
135
135
  it "uses hostname = localhost" do
136
- subject.host.should == host
137
- subject.hostname.should == host
136
+ expect(subject.host).to eq host
137
+ expect(subject.hostname).to eq host
138
138
  end
139
139
 
140
140
  it "uses port 5672" do
141
- subject.port.should == port
141
+ expect(subject.port).to eq port
142
142
  end
143
143
 
144
144
  it "uses username = guest" do
145
- subject.username.should == username
146
- subject.user.should == username
145
+ expect(subject.username).to eq username
146
+ expect(subject.user).to eq username
147
147
  end
148
148
  end
149
149
 
@@ -157,17 +157,17 @@ describe Bunny::Session do
157
157
  let(:subject) { described_class.new(:hosts => hosts) }
158
158
 
159
159
  it "uses hostname = localhost" do
160
- subject.host.should == host
161
- subject.hostname.should == host
160
+ expect(subject.host).to eq host
161
+ expect(subject.hostname).to eq host
162
162
  end
163
163
 
164
164
  it "uses port 5672" do
165
- subject.port.should == port
165
+ expect(subject.port).to eq port
166
166
  end
167
167
 
168
168
  it "uses username = guest" do
169
- subject.username.should == username
170
- subject.user.should == username
169
+ expect(subject.username).to eq username
170
+ expect(subject.user).to eq username
171
171
  end
172
172
  end
173
173
 
@@ -184,7 +184,7 @@ describe Bunny::Session do
184
184
  # for future releases. MK.
185
185
  it "negotiates channel max to be 1024" do
186
186
  subject.start
187
- subject.channel_max.should == channel_max
187
+ expect(subject.channel_max).to eq channel_max
188
188
 
189
189
  subject.close
190
190
  end
@@ -202,7 +202,7 @@ describe Bunny::Session do
202
202
  end
203
203
 
204
204
  it "uses TLS port" do
205
- subject.port.should == tls_port
205
+ expect(subject.port).to eq tls_port
206
206
  end
207
207
  end
208
208
 
@@ -218,7 +218,7 @@ describe Bunny::Session do
218
218
  end
219
219
 
220
220
  it "uses TLS port" do
221
- subject.port.should == tls_port
221
+ expect(subject.port).to eq tls_port
222
222
  end
223
223
  end
224
224
  end
@@ -230,7 +230,7 @@ describe Bunny::Session do
230
230
  end
231
231
 
232
232
  let(:host) { "127.0.0.1" }
233
- # see ./bin/ci/before_build.sh
233
+ # see ./bin/ci/before_build
234
234
  let(:username) { "bunny_gem" }
235
235
  let(:password) { "bunny_password" }
236
236
  let(:vhost) { "bunny_testbed" }
@@ -241,38 +241,38 @@ describe Bunny::Session do
241
241
 
242
242
  it "successfully connects" do
243
243
  5.times { subject.start }
244
- subject.should be_connected
244
+ expect(subject).to be_connected
245
245
 
246
- subject.server_properties.should_not be_nil
247
- subject.server_capabilities.should_not be_nil
246
+ expect(subject.server_properties).not_to be_nil
247
+ expect(subject.server_capabilities).not_to be_nil
248
248
 
249
249
  props = subject.server_properties
250
250
 
251
- props["product"].should_not be_nil
252
- props["platform"].should_not be_nil
253
- props["version"].should_not be_nil
251
+ expect(props["product"]).not_to be_nil
252
+ expect(props["platform"]).not_to be_nil
253
+ expect(props["version"]).not_to be_nil
254
254
  end
255
255
 
256
256
  it "uses hostname = 127.0.0.1" do
257
- subject.host.should == host
258
- subject.hostname.should == host
257
+ expect(subject.host).to eq host
258
+ expect(subject.hostname).to eq host
259
259
  end
260
260
 
261
261
  it "uses port 5672" do
262
- subject.port.should == port
262
+ expect(subject.port).to eq port
263
263
  end
264
264
 
265
265
  it "uses provided vhost" do
266
- subject.vhost.should == vhost
267
- subject.virtual_host.should == vhost
266
+ expect(subject.vhost).to eq vhost
267
+ expect(subject.virtual_host).to eq vhost
268
268
  end
269
269
 
270
270
  it "uses provided username" do
271
- subject.username.should == username
271
+ expect(subject.username).to eq username
272
272
  end
273
273
 
274
274
  it "uses provided password" do
275
- subject.password.should == password
275
+ expect(subject.password).to eq password
276
276
  end
277
277
  end
278
278
 
@@ -283,7 +283,7 @@ describe Bunny::Session do
283
283
  end
284
284
 
285
285
  let(:host) { "127.0.0.1" }
286
- # see ./bin/ci/before_build.sh
286
+ # see ./bin/ci/before_build
287
287
  let(:username) { "bunny_gem" }
288
288
  let(:password) { "bunny_password" }
289
289
  let(:vhost) { "bunny_testbed" }
@@ -294,33 +294,33 @@ describe Bunny::Session do
294
294
 
295
295
  it "successfully connects" do
296
296
  subject.start
297
- subject.should be_connected
297
+ expect(subject).to be_connected
298
298
 
299
- subject.server_properties.should_not be_nil
300
- subject.server_capabilities.should_not be_nil
299
+ expect(subject.server_properties).not_to be_nil
300
+ expect(subject.server_capabilities).not_to be_nil
301
301
 
302
302
  props = subject.server_properties
303
303
 
304
- props["product"].should_not be_nil
305
- props["platform"].should_not be_nil
306
- props["version"].should_not be_nil
304
+ expect(props["product"]).not_to be_nil
305
+ expect(props["platform"]).not_to be_nil
306
+ expect(props["version"]).not_to be_nil
307
307
  end
308
308
 
309
309
  it "uses hostname = 127.0.0.1" do
310
- subject.host.should == host
311
- subject.hostname.should == host
310
+ expect(subject.host).to eq host
311
+ expect(subject.hostname).to eq host
312
312
  end
313
313
 
314
314
  it "uses port 5672" do
315
- subject.port.should == port
315
+ expect(subject.port).to eq port
316
316
  end
317
317
 
318
318
  it "uses provided username" do
319
- subject.username.should == username
319
+ expect(subject.username).to eq username
320
320
  end
321
321
 
322
322
  it "uses provided password" do
323
- subject.password.should == password
323
+ expect(subject.password).to eq password
324
324
  end
325
325
  end
326
326
 
@@ -332,7 +332,7 @@ describe Bunny::Session do
332
332
  end
333
333
 
334
334
  let(:host) { "127.0.0.1" }
335
- # see ./bin/ci/before_build.sh
335
+ # see ./bin/ci/before_build
336
336
  let(:username) { "bunny_gem" }
337
337
  let(:password) { "bunny_password" }
338
338
  let(:vhost) { "bunny_testbed" }
@@ -344,21 +344,21 @@ describe Bunny::Session do
344
344
 
345
345
  it "successfully connects" do
346
346
  subject.start
347
- subject.should be_connected
347
+ expect(subject).to be_connected
348
348
 
349
- subject.server_properties.should_not be_nil
350
- subject.server_capabilities.should_not be_nil
349
+ expect(subject.server_properties).not_to be_nil
350
+ expect(subject.server_capabilities).not_to be_nil
351
351
 
352
352
  props = subject.server_properties
353
353
 
354
- props["product"].should_not be_nil
355
- props["platform"].should_not be_nil
356
- props["version"].should_not be_nil
357
- props["capabilities"].should_not be_nil
354
+ expect(props["product"]).not_to be_nil
355
+ expect(props["platform"]).not_to be_nil
356
+ expect(props["version"]).not_to be_nil
357
+ expect(props["capabilities"]).not_to be_nil
358
358
 
359
359
  # this is negotiated with RabbitMQ, so we need to
360
360
  # establish the connection first
361
- subject.heartbeat.should == interval
361
+ expect(subject.heartbeat).to eq interval
362
362
  end
363
363
  end
364
364
 
@@ -366,7 +366,7 @@ describe Bunny::Session do
366
366
 
367
367
  context "initialized with :host => 127.0.0.1 and INVALID credentials" do
368
368
  let(:host) { "127.0.0.1" }
369
- # see ./bin/ci/before_build.sh
369
+ # see ./bin/ci/before_build
370
370
  let(:username) { "bunny_gem#{Time.now.to_i}" }
371
371
  let(:password) { "sdjkfhsdf8ysd8fy8" }
372
372
  let(:vhost) { "___sd89aysd98789" }
@@ -376,27 +376,27 @@ describe Bunny::Session do
376
376
  end
377
377
 
378
378
  it "fails to connect" do
379
- lambda do
379
+ expect do
380
380
  subject.start
381
- end.should raise_error(Bunny::PossibleAuthenticationFailureError)
381
+ end.to raise_error(Bunny::PossibleAuthenticationFailureError)
382
382
  end
383
383
 
384
384
  it "uses provided username" do
385
- subject.username.should == username
385
+ expect(subject.username).to eq username
386
386
  end
387
387
 
388
388
  it "uses provided password" do
389
- subject.password.should == password
389
+ expect(subject.password).to eq password
390
390
  end
391
391
  end
392
392
 
393
393
 
394
394
  context "initialized with unreachable host or port" do
395
395
  it "fails to connect" do
396
- lambda do
396
+ expect do
397
397
  c = described_class.new(:port => 38000)
398
398
  c.start
399
- end.should raise_error(Bunny::TCPConnectionFailed)
399
+ end.to raise_error(Bunny::TCPConnectionFailed)
400
400
  end
401
401
 
402
402
  it "is not connected" do
@@ -407,7 +407,7 @@ describe Bunny::Session do
407
407
  true
408
408
  end
409
409
 
410
- subject.status.should == :not_connected
410
+ expect(subject.status).to eq :not_connected
411
411
  end
412
412
 
413
413
  it "is not open" do
@@ -418,7 +418,7 @@ describe Bunny::Session do
418
418
  true
419
419
  end
420
420
 
421
- subject.should_not be_open
421
+ expect(subject).not_to be_open
422
422
  end
423
423
  end
424
424
 
@@ -431,7 +431,7 @@ describe Bunny::Session do
431
431
  conn = described_class.new(:hostname => "localhost", :logger => logger)
432
432
  conn.start
433
433
 
434
- io.string.length.should > 100
434
+ expect(io.string.length).to be > 100
435
435
 
436
436
  conn.close
437
437
  end