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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c6e1ab5b64d51e0a5723b686711573c11a39cf5a
4
- data.tar.gz: f8700621a089b0f6cd594c7f2fc1d6677cd321aa
3
+ metadata.gz: 7035cf94d8295c49d7e57deb2143be7ed1b6a465
4
+ data.tar.gz: 0387323f9a4029809fbe05c5160731c2a9839ccc
5
5
  SHA512:
6
- metadata.gz: 0682d6723a1530cfcb39b384027108ea306206fc7c275b86961d8fed701f7363688cd9cac888e97b890463bbff126194a04954dbc3821c6dd9463586182c81c5
7
- data.tar.gz: 79e3f21253c27c279050a7c5d730a4d65e2ae122f72a64b7830e0d07c56cc108063c791f1b00b1ae9eea997088e2bcbe2d758bcb46d1ea0d65e62f004b4bc5be
6
+ metadata.gz: 0a4ab1f554f8445a4d7a283ba182a2c6b8244c5371295cd81478c24da0daaf00a71eeb477dfc1bd14dcb22f9b5ef28de938672edc8907a17fae3d0ac07c18b1c
7
+ data.tar.gz: 68cc7911d99ee0161f3c09383d06f88ba482c4a0ab3e04f21049cdd94bbdac46e108598dde44ebff97a3671994a54679602a44727001363f2770ca8935e922be
@@ -1,7 +1,7 @@
1
1
  language: ruby
2
2
  bundler_args: --without development
3
3
  before_script: "./bin/ci/before_build"
4
- script: "bundle exec rspec -cfs spec"
4
+ script: "bundle exec rspec -cf documentation spec"
5
5
  rvm:
6
6
  - "2.1.0"
7
7
  - "2.0"
@@ -0,0 +1,14 @@
1
+ ## Pre-requisites
2
+
3
+ The project uses Bundler for dependency management and requires RabbitMQ `3.4+` to be running
4
+ locally. Prior to running the tests, configure the RabbitMQ permissions
5
+ by running `./bin/ci/before_script`. Make
6
+ sure you have those two installed and then run tests:
7
+
8
+ bundle install
9
+ bundle exec rspec -cfd spec/
10
+
11
+ ## Pull Requests
12
+
13
+ Then create a branch and make your changes on it. Once you are done with your changes and all
14
+ tests pass, write a [good, detailed commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) submit a pull request on GitHub.
@@ -1,11 +1,12 @@
1
- ## Changes between Bunny 1.7.0 and 1.7.1
1
+ ## Changes between Bunny 1.7.0 and 1.8.0
2
2
 
3
- ### amq-protocol Dependendency Locked to 1.9.x
3
+ ### Reduced Timeout Use
4
4
 
5
- Since `amq-protocol` 2.0 requires Ruby 2.0 or later, 1.7.x versions of Bunny
6
- must use `1.9.2`.
5
+ `Bunny::ContinuationQueue#poll` no longer relies on Ruby's `Timeout` which has
6
+ numerous issues, including starting a new "interruptor" thread per operation,
7
+ which is far from efficient.
7
8
 
8
- GH issue: [#336](https://github.com/ruby-amqp/bunny/issues/336).
9
+ Contributed by Joe Eli McIlvain.
9
10
 
10
11
  ### Logger Output Remains Consistent
11
12
 
@@ -15,6 +16,13 @@ Behaviour remains unchainged when the internally initialized logger is used.
15
16
 
16
17
  Contributed by Justin Carter.
17
18
 
19
+ ### prefetch_count is Limited to 65535
20
+
21
+ Since `basic.qos`'s `prefetch_count` field is of type `short` in the protocol,
22
+ Bunny must enforce its maximum allowed value to `2^16 - 1` to avoid
23
+ confusing issues due to overflow.
24
+
25
+
18
26
 
19
27
  ## Changes between Bunny 1.6.0 and 1.7.0
20
28
 
@@ -136,6 +144,13 @@ Connection shuffling and robustness improvements.
136
144
 
137
145
  Contributed by Andre Foeken (Nedap).
138
146
 
147
+ ### Default Channel Removed
148
+
149
+ Breaks compatibility with Bunny 0.8.x.
150
+
151
+ `Bunny:Session#default_channel` was removed. Please open channels explicitly now,
152
+ as all the examples in the docs do.
153
+
139
154
 
140
155
  ## Changes between Bunny 1.3.0 and 1.4.0
141
156
 
@@ -549,7 +564,7 @@ Bunny now will use the following TLS/SSL CA's paths on Linux by default:
549
564
  and will log a warning if no CA files are available via default paths
550
565
  or `:tls_ca_certificates`.
551
566
 
552
- Contributed by Carl Hörberg.
567
+ Contributed by Carl Hörberg.
553
568
 
554
569
  ### Consumers Can Be Re-Registered From Bunny::Consumer#handle_cancellation
555
570
 
data/Gemfile CHANGED
@@ -34,7 +34,7 @@ group :development do
34
34
  end
35
35
 
36
36
  group :test do
37
- gem "rspec", "~> 2.13.0"
37
+ gem "rspec", "~> 3.2.0"
38
38
  gem "rabbitmq_http_api_client", "~> 1.2.0"
39
39
  end
40
40
 
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 – 2014 Chris Duncan, Jakub Stastny aka botanicus,
1
+ Copyright (c) 2009 – 2015 Chris Duncan, Jakub Stastny aka botanicus,
2
2
  Michael S. Klishin, Eric Lindvall, Stefan Kaes and contributors.
3
3
 
4
4
  Permission is hereby granted, free of charge, to any person obtaining
data/README.md CHANGED
@@ -12,8 +12,8 @@ have any heavyweight dependencies.
12
12
 
13
13
  ## What is Bunny Good For?
14
14
 
15
- One can use amqp gem to make Ruby applications interoperate with other
16
- applications (both Ruby and not). Complexity and size may vary from
15
+ One can use Bunny to make Ruby applications interoperate with other
16
+ applications (both built in Ruby and not). Complexity and size may vary from
17
17
  simple work queues to complex multi-stage data processing workflows that involve
18
18
  many applications built with all kinds of technologies.
19
19
 
@@ -46,9 +46,9 @@ Specific examples:
46
46
 
47
47
  ## Supported Ruby Versions
48
48
 
49
- Bunny 0.9 and more recent versions support
49
+ Modern Bunny versions support
50
50
 
51
- * CRuby 2.1, CRuby 2.0, 1.9.3, 1.9.2, and 1.8.7
51
+ * CRuby 2.2, 2.1, 2.0, 1.9.3, and 1.8.7
52
52
  * Rubinius 2.0+
53
53
 
54
54
  Bunny works sufficiently well on JRuby but there are known
@@ -59,7 +59,7 @@ use [March Hare](http://rubymarchhare.info).
59
59
  ## Supported RabbitMQ Versions
60
60
 
61
61
  Bunny `1.5.0` (including previews) and later versions only support RabbitMQ `3.3+`.
62
- Bunny `1.4.x` and supports RabbitMQ 2.x and 3.x.
62
+ Bunny `1.4.x` and earlier supports RabbitMQ 2.x and 3.x.
63
63
 
64
64
 
65
65
  ## Project Maturity
@@ -95,7 +95,7 @@ gem install bunny
95
95
  To use Bunny in a project managed with Bundler:
96
96
 
97
97
  ``` ruby
98
- gem "bunny", "~> 1.4.0"
98
+ gem "bunny", ">= 1.7.0"
99
99
  ```
100
100
 
101
101
 
@@ -177,7 +177,6 @@ To subscribe for announcements of releases, important changes and so on, please
177
177
  More detailed announcements can be found in the blogs
178
178
 
179
179
  * [RabbitMQ Ruby clients blog](http://blog.rubyrabbitmq.info)
180
- * [Bunny Blog](http://bunnyamqp.wordpress.com)
181
180
 
182
181
 
183
182
  ### Reporting Issues
@@ -191,32 +190,36 @@ try to explain what behavior you expected and why. Bonus points for
191
190
  contributing failing test cases.
192
191
 
193
192
 
194
- ### Running the specs
193
+ ### Running the Specs
195
194
 
196
195
  The cleanest way to get the specs running is by starting a clean rabbitmq server
197
196
  node on your machine specifically for the bunny specs.
198
197
 
199
- Make sure you have a recent version of RabbitMQ (> 3.2) and run the following command
198
+ Make sure you have a recent version of RabbitMQ (> 3.4) and run the following command
200
199
  from the base directory of the gem:
201
200
 
202
- `RABBITMQ_NODENAME=bunny RABBITMQ_CONFIG_FILE=./spec/config/rabbitmq RABBITMQ_ENABLED_PLUGINS_FILE=./spec/config/enabled_plugins rabbitmq-server`
201
+ ```
202
+ RABBITMQ_NODENAME=bunny RABBITMQ_CONFIG_FILE=./spec/config/rabbitmq RABBITMQ_ENABLED_PLUGINS_FILE=./spec/config/enabled_plugins rabbitmq-server
203
+ ```
203
204
 
204
- > The specs use the Rabbitmq management plugin and require an SSL port to be available. The config files in the spec/config directory enable these. Please note that this config uses verify_none because the certificates are expired.
205
+ The specs use the RabbitMQ management plugin and require a TLS port to be available. The config files in the spec/config directory enable these.
205
206
 
206
207
  Next up you'll need to prepare your node for the specs (Only once):
207
208
 
208
- `RABBITMQ_NODENAME=bunny ./bin/ci/before_build.sh`
209
+ ```
210
+ RABBITMQ_NODENAME=bunny ./bin/ci/before_build
211
+ ```
209
212
 
210
213
  And then run the specs:
211
214
 
212
- `RABBITMQ_NODENAME=bunny rspec`
215
+ ```
216
+ RABBITMQ_NODENAME=bunny rspec
217
+ ```
213
218
 
214
219
  ## Other Ruby RabbitMQ Clients
215
220
 
216
- Other widely used Ruby RabbitMQ clients are [March
217
- Hare](http://rubymarchhare.info) (JRuby-only) and [amqp
218
- gem](http://rubyamqp.info). Both are mature libraries and require
219
- RabbitMQ 2.x or 3.x.
221
+ The other widely used Ruby RabbitMQ client is [March Hare](http://rubymarchhare.info) (JRuby-only).
222
+ It's a mature library that require RabbitMQ 3.3.x or later.
220
223
 
221
224
 
222
225
  ## Contributing
@@ -227,13 +230,13 @@ First, clone the repository and run
227
230
 
228
231
  then set up RabbitMQ vhosts with
229
232
 
230
- ./bin/ci/before_build.sh
233
+ ./bin/ci/before_build
231
234
 
232
235
  (if needed, set `RABBITMQCTL` env variable to point to `rabbitmqctl` you want to use)
233
236
 
234
237
  and then run tests with
235
238
 
236
- CI=true ./bin/rspec -cfs spec
239
+ CI=true ./bin/rspec -cf documentation spec
237
240
 
238
241
  After that create a branch and make your changes on it. Once you are done with your changes and all tests pass, submit a pull request
239
242
  on GitHub.
@@ -242,7 +245,3 @@ on GitHub.
242
245
  ## License
243
246
 
244
247
  Released under the MIT license.
245
-
246
-
247
- [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/ruby-amqp/bunny/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
248
-
@@ -29,7 +29,7 @@ Gem::Specification.new do |s|
29
29
  map { |mail| Base64.decode64(mail) }
30
30
 
31
31
  # Dependencies
32
- s.add_dependency "amq-protocol", "~> 1.9.2"
32
+ s.add_dependency "amq-protocol", ">= 1.9.2"
33
33
 
34
34
  # Files.
35
35
  s.has_rdoc = true
@@ -246,6 +246,14 @@ module Bunny
246
246
  @status == :closed
247
247
  end
248
248
 
249
+ def to_s
250
+ oid = ("0x%x" % (self.object_id << 1))
251
+ "<#{self.class.name}:#{oid} number=#{@channel.id} @open=#{open?} connection=#{@connection.to_s}>"
252
+ end
253
+
254
+ def inspect
255
+ to_s
256
+ end
249
257
 
250
258
  #
251
259
  # @group Backwards compatibility with 0.8.0
@@ -615,6 +623,9 @@ module Bunny
615
623
  @last_basic_get_response
616
624
  end
617
625
 
626
+ # prefetch_count is of type short in the protocol. MK.
627
+ MAX_PREFETCH_COUNT = (2 ** 16) - 1
628
+
618
629
  # Controls message delivery rate using basic.qos AMQP 0.9.1 method.
619
630
  #
620
631
  # @param [Integer] prefetch_count How many messages can consumers on this channel be given at a time
@@ -626,6 +637,7 @@ module Bunny
626
637
  # @api public
627
638
  def basic_qos(count, global = false)
628
639
  raise ArgumentError.new("prefetch count must be a positive integer, given: #{prefetch_count}") if count < 0
640
+ raise ArgumentError.new("prefetch count must be no greater than #{MAX_PREFETCH_COUNT}, given: #{prefetch_count}") if count > MAX_PREFETCH_COUNT
629
641
  raise_if_no_longer_open!
630
642
 
631
643
  @connection.send_frame(AMQ::Protocol::Basic::Qos.encode(@id, 0, count, global))
@@ -6,36 +6,53 @@ module Bunny
6
6
  #
7
7
  # @private
8
8
  class ContinuationQueue
9
- def initialize(*args, &block)
10
- @q = ::Queue.new(*args)
9
+ def initialize
10
+ @q = []
11
+ @lock = ::Mutex.new
12
+ @cond = ::ConditionVariable.new
11
13
  end
12
14
 
13
- def push(*args)
14
- @q.push(*args)
15
+ def push(item)
16
+ @lock.synchronize do
17
+ @q.push(item)
18
+ @cond.signal
19
+ end
15
20
  end
16
21
  alias << push
17
22
 
18
23
  def pop
19
- @q.pop
24
+ poll
20
25
  end
21
26
 
22
27
  def poll(timeout_in_ms = nil)
23
- if timeout_in_ms
24
- Bunny::Timeout.timeout(timeout_in_ms / 1000.0, ::Timeout::Error) do
25
- @q.pop
28
+ timeout = timeout_in_ms ? timeout_in_ms / 1000.0 : nil
29
+
30
+ @lock.synchronize do
31
+ if @q.empty?
32
+ @cond.wait(@lock, timeout)
33
+ raise ::Timeout::Error if @q.empty?
26
34
  end
27
- else
28
- @q.pop
35
+ item = @q.shift
36
+ @cond.signal
37
+
38
+ item
29
39
  end
30
40
  end
31
41
 
32
42
  def clear
33
- @q.clear
43
+ @lock.synchronize do
44
+ @q.clear
45
+ end
46
+ end
47
+
48
+ def empty?
49
+ @q.empty?
34
50
  end
35
51
 
36
- def method_missing(selector, *args, &block)
37
- @q.__send__(selector, *args, &block)
52
+ def size
53
+ @q.size
38
54
  end
55
+ alias length size
39
56
  end
40
57
  end
41
58
  end
@@ -245,11 +245,6 @@ module Bunny
245
245
  @channel.exchange_declare(@name, @type, @options)
246
246
  end
247
247
 
248
- # @private
249
- def self.add_default_options(name, opts, block)
250
- { :exchange => name, :nowait => (block.nil? && !name.empty?) }.merge(opts)
251
- end
252
-
253
248
  # @private
254
249
  def self.add_default_options(name, opts)
255
250
  # :nowait is always false for Bunny
@@ -5,8 +5,7 @@ module Bunny
5
5
  # TCP socket extension that uses Socket#readpartial to avoid excessive CPU
6
6
  # burn after some time. See issue #165.
7
7
  # @private
8
- module Socket
9
- include Bunny::Socket
8
+ class Socket < Bunny::Socket
10
9
 
11
10
  # Reads given number of bytes with an optional timeout
12
11
  #
@@ -88,6 +88,15 @@ module Bunny
88
88
  @arguments
89
89
  end
90
90
 
91
+ def to_s
92
+ oid = ("0x%x" % (self.object_id << 1))
93
+ "<#{self.class.name}:#{oid} @name=\"#{name}\" channel=#{@channel.to_s} @durable=#{@durable} @auto_delete=#{@auto_delete} @exclusive=#{@exclusive} @arguments=#{@arguments}>"
94
+ end
95
+
96
+ def inspect
97
+ to_s
98
+ end
99
+
91
100
  # Binds queue to an exchange
92
101
  #
93
102
  # @param [Bunny::Exchange,String] exchange Exchange to bind to
@@ -284,19 +284,15 @@ module Bunny
284
284
  self.start_reader_loop if threaded?
285
285
 
286
286
  rescue TCPConnectionFailed => e
287
-
288
287
  @logger.warn e.message
289
-
290
288
  self.initialize_transport
291
-
292
- @logger.warn "Retrying connection on next host in line: #{@transport.host}:#{@transport.port}"
289
+ @logger.warn "Will try to connect to the next endpoint in line: #{@transport.host}:#{@transport.port}"
293
290
 
294
291
  return self.start
295
292
  rescue
296
293
  @status_mutex.synchronize { @status = :not_connected }
297
294
  raise
298
295
  end
299
-
300
296
  rescue HostListDepleted
301
297
  self.reset_host_index
302
298
  @status_mutex.synchronize { @status = :not_connected }
@@ -940,7 +936,12 @@ module Bunny
940
936
  # @return [String]
941
937
  # @api public
942
938
  def to_s
943
- "#<#{self.class.name}:#{object_id} #{@user}@#{host}:#{@port}, vhost=#{@vhost}, hosts=[#{@hosts.join(',')}]>"
939
+ oid = ("0x%x" % (self.object_id << 1))
940
+ "#<#{self.class.name}:#{oid} #{@user}@#{host}:#{@port}, vhost=#{@vhost}, hosts=[#{@hosts.join(',')}]>"
941
+ end
942
+
943
+ def inspect
944
+ to_s
944
945
  end
945
946
 
946
947
  protected
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Bunny
4
4
  # @return [String] Version of the library
5
- VERSION = "1.7.1"
5
+ VERSION = "2.0.0.rc1"
6
6
  end
@@ -19,11 +19,11 @@ describe Bunny::Channel, "#ack" do
19
19
 
20
20
  x.publish("bunneth", :routing_key => q.name)
21
21
  sleep 0.5
22
- q.message_count.should == 1
22
+ expect(q.message_count).to eq 1
23
23
  delivery_details, properties, content = q.pop(:manual_ack => true)
24
24
 
25
25
  ch.ack(delivery_details.delivery_tag, true)
26
- q.message_count.should == 0
26
+ expect(q.message_count).to eq 0
27
27
 
28
28
  ch.close
29
29
  end
@@ -42,9 +42,9 @@ describe Bunny::Channel, "#ack" do
42
42
 
43
43
  x.publish("bunneth", :routing_key => q.name)
44
44
  sleep 0.5
45
- lambda do
45
+ expect do
46
46
  q.message_count
47
- end.should raise_error(Bunny::ChannelAlreadyClosed)
47
+ end.to raise_error(Bunny::ChannelAlreadyClosed)
48
48
  end
49
49
  end
50
50
 
@@ -56,7 +56,7 @@ describe Bunny::Channel, "#ack" do
56
56
 
57
57
  x.publish("bunneth", :routing_key => q.name)
58
58
  sleep 0.5
59
- q.message_count.should == 1
59
+ expect(q.message_count).to eq 1
60
60
  _, _, content = q.pop(:manual_ack => true)
61
61
 
62
62
  ch.on_error do |ch, channel_close|
@@ -65,7 +65,7 @@ describe Bunny::Channel, "#ack" do
65
65
  ch.ack(82, true)
66
66
  sleep 0.25
67
67
 
68
- @channel_close.reply_code.should == AMQ::Protocol::PreconditionFailed::VALUE
68
+ expect(@channel_close.reply_code).to eq AMQ::Protocol::PreconditionFailed::VALUE
69
69
  end
70
70
  end
71
71
 
@@ -77,7 +77,7 @@ describe Bunny::Channel, "#ack" do
77
77
 
78
78
  x.publish("bunneth", :routing_key => q.name)
79
79
  sleep 0.5
80
- q.message_count.should == 1
80
+ expect(q.message_count).to eq 1
81
81
 
82
82
  orig_stderr = $stderr
83
83
  $stderr = StringIO.new
@@ -85,12 +85,12 @@ describe Bunny::Channel, "#ack" do
85
85
  delivery_details, properties, content = q.pop(:ack => true)
86
86
 
87
87
  $stderr.rewind
88
- $stderr.string.chomp.should eq("[DEPRECATION] `:ack` is deprecated. Please use `:manual_ack` instead.\n[DEPRECATION] `:ack` is deprecated. Please use `:manual_ack` instead.")
88
+ expect($stderr.string.chomp).to eq("[DEPRECATION] `:ack` is deprecated. Please use `:manual_ack` instead.\n[DEPRECATION] `:ack` is deprecated. Please use `:manual_ack` instead.")
89
89
 
90
90
  $stderr = orig_stderr
91
91
 
92
92
  ch.ack(delivery_details.delivery_tag, true)
93
- q.message_count.should == 0
93
+ expect(q.message_count).to eq 0
94
94
 
95
95
  ch.close
96
96
  end