Module: Tochtli::Test::Client

Extended by:
UnitTestSupport
Includes:
Helpers
Defined in:
lib/tochtli/test/client.rb

Instance Method Summary collapse

Methods included from UnitTestSupport

append_features, included

Methods included from Helpers

#assert_published, #expect_published

Instance Method Details

#before_setupObject



9
10
11
12
13
14
# File 'lib/tochtli/test/client.rb', line 9

def before_setup
  super
  @logger      = Tochtli.logger
  @client      = Tochtli::RabbitClient.new(@connection, @logger)
  @reply_queue = @client.reply_queue
end

#create_reply(reply_class, original_message, attributes) ⇒ Object



16
17
18
19
# File 'lib/tochtli/test/client.rb', line 16

def create_reply(reply_class, original_message, attributes)
  properties = TestMessageProperties.new(nil, reply_class.generate_id, original_message.id)
  reply_class.new(attributes, properties)
end

#handle_reply(reply_class, original_message, attributes) ⇒ Object



21
22
23
24
25
# File 'lib/tochtli/test/client.rb', line 21

def handle_reply(reply_class, original_message, attributes)
  reply = create_reply(reply_class, original_message, attributes)
  @reply_queue.handle_reply reply
  reply
end