Class: Karafka::Testing::Minitest::Proxy

Inherits:
Object
  • Object
show all
Defined in:
lib/karafka/testing/minitest/proxy.rb

Overview

Proxy object for a nicer karafka. API within Minitest None other should be used by the end users

Instance Method Summary collapse

Constructor Details

#initialize(minitest_example) ⇒ Proxy

Returns a new instance of Proxy.

Parameters:

  • minitest_example (Minitest::Test)

    minitest context



10
11
12
# File 'lib/karafka/testing/minitest/proxy.rb', line 10

def initialize(minitest_example)
  @minitest_example = minitest_example
end

Instance Method Details

#consumer_for(*args) ⇒ Object

Parameters:

  • args

    Anything that the #_karafka_consumer_for accepts



15
16
17
# File 'lib/karafka/testing/minitest/proxy.rb', line 15

def consumer_for(*args)
  @minitest_example._karafka_consumer_for(*args)
end

#consumer_messagesArray<Karafka::Messages::Message>

Returns array of messages that will be used to construct the final consumer messages batch.

Returns:

  • (Array<Karafka::Messages::Message>)

    array of messages that will be used to construct the final consumer messages batch



31
32
33
# File 'lib/karafka/testing/minitest/proxy.rb', line 31

def consumer_messages
  @minitest_example._karafka_consumer_messages
end

#produce(*args) ⇒ Object

Parameters:

  • args

    Anything that #_karafka_produce accepts



20
21
22
# File 'lib/karafka/testing/minitest/proxy.rb', line 20

def produce(*args)
  @minitest_example._karafka_produce(*args)
end

#produced_messagesArray<Hash>

Returns messages produced via Karafka#producer.

Returns:

  • (Array<Hash>)

    messages produced via Karafka#producer



25
26
27
# File 'lib/karafka/testing/minitest/proxy.rb', line 25

def produced_messages
  @minitest_example._karafka_produced_messages
end