Class: Lapine::Test::FakeExchange

Inherits:
Object
  • Object
show all
Defined in:
lib/lapine/test/exchange.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFakeExchange

Returns a new instance of FakeExchange.



18
19
20
# File 'lib/lapine/test/exchange.rb', line 18

def initialize
  @histories = []
end

Instance Attribute Details

#historiesObject (readonly)

Returns the value of attribute histories.



16
17
18
# File 'lib/lapine/test/exchange.rb', line 16

def histories
  @histories
end

Instance Method Details

#bind(history) ⇒ Object



26
27
28
# File 'lib/lapine/test/exchange.rb', line 26

def bind(history)
  histories << history
end

#channelObject



22
23
24
# File 'lib/lapine/test/exchange.rb', line 22

def channel
  @channel ||= FakeChannel.new
end

#publish(body, routing_key = nil) ⇒ Object



30
31
32
33
34
# File 'lib/lapine/test/exchange.rb', line 30

def publish(body, routing_key = nil)
  histories.each do |h|
    h.publish(body, routing_key)
  end
end