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, **opts) ⇒ Hash{String => Mixed}
A simple helper to parse a blob of Apache Avro data.
-
#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, **opts) ⇒ 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, **opts) Rimless.avro_decode(data, **opts) end |
#kafka_message(topic: nil, headers: {}, **payload) ⇒ OpenStruct
A simple helper to fake a deserialized Apache Kafka message for consuming.
rubocop:disable Metrics/MethodLength because of the various properties
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rimless/rspec/helpers.rb', line 26 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 |