class BunnyCleaner
Public Class Methods
clean()
click to toggle source
# File lib/gorg_service/rspec/bunny_cleaner.rb, line 51 def clean connections=[] @registered_channels.each do |ch| c=ch.connection connections<<c c.start unless c.status == :open c.with_channel do |chan| ch.queues.keys.each{|q| c.queue_exists?(q)&&chan.queue_delete(q) } ch.exchanges.keys.each{|ex| c.exchange_exists?(ex)&&chan.exchange_delete(ex) } end end connections.uniq.each{|c|c.stop} end
cleaning(&block)
click to toggle source
# File lib/gorg_service/rspec/bunny_cleaner.rb, line 41 def cleaning(&block) begin init_cleaning block.call ensure clean end end
init_cleaning()
click to toggle source
# File lib/gorg_service/rspec/bunny_cleaner.rb, line 66 def init_cleaning registered_channels.clear end
method_missing(method, *args, &block)
click to toggle source
# File lib/gorg_service/rspec/bunny_cleaner.rb, line 32 def self.method_missing(method, *args, &block) Bunny.send(method, *args, &block) end
new(*args, &block)
click to toggle source
# File lib/gorg_service/rspec/bunny_cleaner.rb, line 24 def initialize(*args, &block) @target=Session.new(*args, &block) end
registered_channels()
click to toggle source
# File lib/gorg_service/rspec/bunny_cleaner.rb, line 37 def registered_channels @registered_channels||=[] end
Public Instance Methods
method_missing(method, *args, &block)
click to toggle source
# File lib/gorg_service/rspec/bunny_cleaner.rb, line 28 def method_missing(method, *args, &block) @target.send(method, *args, &block) end