Module: PactMessageHelpers::ProviderHelpers

Defined in:
lib/sbmt/pact/rspec/support/pact_message_helpers.rb

Instance Method Summary collapse

Instance Method Details

#produce_outbox_item(item) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/sbmt/pact/rspec/support/pact_message_helpers.rb', line 13

def produce_outbox_item(item)
  raise "Please require sbmt/kafka_producer to use helper" unless defined?(::Sbmt::KafkaProducer)

  with_pact_producer do |client|
    Sbmt::KafkaProducer::OutboxProducer.new(
      client: client, topic: item.transports.first.topic
    ).call(item, item.payload)
  end
end

#with_pact_producer {|client| ... } ⇒ Object

Yields:

  • (client)


7
8
9
10
11
# File 'lib/sbmt/pact/rspec/support/pact_message_helpers.rb', line 7

def with_pact_producer
  client = PactWaterdropClient.new
  yield(client)
  client.to_pact
end