diff --git a/lib/bunny_mock/queue.rb b/lib/bunny_mock/queue.rb index 9da2c6a..db98f1c 100644 --- a/lib/bunny_mock/queue.rb +++ b/lib/bunny_mock/queue.rb @@ -31,6 +31,12 @@ def initialize(channel, name = '', opts = {}) # Store messages @messages = [] + + # Store consumers subsribed to that queue + @consumers = [] + + # marks if this queue is deleted + @deleted = false end # @group Bunny API @@ -78,7 +84,6 @@ def publish(payload, opts = {}) # @api public # def subscribe(*args, &block) - @consumers ||= [] @consumers << [block, args] yield_consumers @@ -94,7 +99,6 @@ def subscribe(*args, &block) # @api public # def subscribe_with(consumer, *args) - @consumers ||= [] @consumers << [consumer, args] yield_consumers @@ -257,7 +261,6 @@ def pop_response(message) # @private def yield_consumers - return if @consumers.nil? @consumers.each do |c, args| # rubocop:disable AssignmentInCondition while message = all.pop