class Bunny::Testing

Constants

VERSION

Attributes

exchanges[R]

Public Class Methods

exchanges() click to toggle source
# File lib/bunny/testing.rb, line 13
def exchanges
  instance.exchanges
end
new() click to toggle source
# File lib/bunny/testing.rb, line 26
def initialize
  reset_queue!
end
queue(exchange:, routing_key: nil) click to toggle source
# File lib/bunny/testing.rb, line 17
def queue(exchange:, routing_key: nil)
  instance.queue(exchange: exchange, routing_key: routing_key)
end
reset_queue!() click to toggle source
# File lib/bunny/testing.rb, line 21
def reset_queue!
  instance.reset_queue!
end

Public Instance Methods

queue(exchange:, routing_key: nil) click to toggle source
# File lib/bunny/testing.rb, line 30
def queue(exchange:, routing_key: nil)
  messages = exchanges[exchange]

  return messages.find_all { |message| message[:routing_key] == routing_key } unless routing_key.nil?

  messages
end
reset_queue!() click to toggle source
# File lib/bunny/testing.rb, line 38
def reset_queue!
  @exchanges = Hash.new { |hash, key| hash[key] = [] }
end