Module: Rimless::RSpec::Helpers
- Defined in:
- lib/rimless/rspec/helpers.rb
Overview
A collection of Rimless/RSpec helpers.
Instance Method Summary collapse
-
#avro_parse(data) ⇒ Hash{String => Mixed}
A simple helper to parse a blob of Apache Avro data.
-
#capture_kafka_messages { ... } ⇒ Array<Hash{Symbol => Mixed}>
Capture all Apache Kafka messages of the given block.
-
#kafka_message(topic: nil, headers: {}, **payload) ⇒ OpenStruct
A simple helper to fake a deserialized Apache Kafka message for consuming.
Instance Method Details
#avro_parse(data) ⇒ Hash{String => Mixed}
A simple helper to parse a blob of Apache Avro data.
13 14 15 |
# File 'lib/rimless/rspec/helpers.rb', line 13 def avro_parse(data, **) Rimless.avro_decode(data, **) end |
#capture_kafka_messages { ... } ⇒ Array<Hash{Symbol => Mixed}>
Capture all Apache Kafka messages of the given block.
43 44 45 |
# File 'lib/rimless/rspec/helpers.rb', line 43 def (&) Rimless::RSpec::Matchers::HaveSentKafkaMessage.new(nil).capture(&) end |
#kafka_message(topic: nil, headers: {}, **payload) ⇒ OpenStruct
A simple helper to fake a deserialized Apache Kafka message for consuming.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/rimless/rspec/helpers.rb', line 24 def (topic: nil, headers: {}, **payload) OpenStruct.new( topic: Rimless.topic(topic), headers: headers, payload: payload, is_control_record: false, key: nil, offset: 206, partition: 0, create_time: Time.current, receive_time: Time.current, deserialized: true ) end |