class Tochtli::Test::TestRabbitConnection
Attributes
channel[R]
exchange[R]
publications[R]
Public Class Methods
new()
click to toggle source
# File lib/tochtli/test/test_case.rb, line 36 def initialize @channel = TestRabbitChannel.new(self) @exchange = TestRabbitExchange.new @publications = [] @queues = {} end
Public Instance Methods
callback(&block)
click to toggle source
# File lib/tochtli/test/test_case.rb, line 60 def callback(&block) @callback = block end
create_channel(consumer_pool_size = 1)
click to toggle source
# File lib/tochtli/test/test_case.rb, line 87 def create_channel(consumer_pool_size = 1) TestRabbitChannel.new(self) end
exchange_name()
click to toggle source
# File lib/tochtli/test/test_case.rb, line 43 def exchange_name @exchange.name end
get_publication()
click to toggle source
# File lib/tochtli/test/test_case.rb, line 56 def get_publication @publications.shift end
logger()
click to toggle source
# File lib/tochtli/test/test_case.rb, line 71 def logger Logger.new(STDOUT) end
publish(routing_key, message, options={})
click to toggle source
# File lib/tochtli/test/test_case.rb, line 51 def publish(routing_key, message, options={}) @publications << options.merge(routing_key: routing_key, message: message) run_callback end
queue(name=nil, routing_keys=[], options={})
click to toggle source
# File lib/tochtli/test/test_case.rb, line 75 def queue(name=nil, routing_keys=[], options={}) queue = @queues[name] unless queue @queues[name] = queue = TestQueue.new(@channel, name, options) end queue end
queue_exists?(name)
click to toggle source
# File lib/tochtli/test/test_case.rb, line 83 def queue_exists?(name) @queues.has_key?(name) end
reply_queue()
click to toggle source
# File lib/tochtli/test/test_case.rb, line 47 def reply_queue @reply_queue ||= Tochtli::ReplyQueue.new(self) end
run_callback()
click to toggle source
# File lib/tochtli/test/test_case.rb, line 64 def run_callback if @callback @callback.call @callback = nil end end