lib/rimless/rspec/matchers.rb
def listen_to_messages
          decode = proc do |encoded|
            { encoded_data: encoded, data: Rimless.avro.decode(encoded) }
          end

          allow(WaterDrop::SyncProducer).to receive(:call) do |data, **args|
            @messages << { args: args, type: :sync }.merge(decode[data])
            nil
          end

          allow(WaterDrop::AsyncProducer).to receive(:call) do |data, **args|
            @messages << { args: args, type: :async }.merge(decode[data])
            nil
          end
        end
# Setup the +WaterDrop+ spies and record each sent message.
#
# rubocop:disable Metrics/AbcSize because of the message decoding
# rubocop:disable Metrics/MethodLength dito
Setup the +WaterDrop+ spies and record each sent message.
rubocop:disable Metrics/AbcSize because of the message decoding
rubocop:disable Metrics/MethodLength dito
Setup the + WaterDrop + spies and record each sent message . rubocop : disable Metrics / AbcSize because of the message decoding rubocop : disable Metrics / MethodLength dito
def listen_to_messages
          decode = proc do |encoded|
            { encoded_data: encoded, data: Rimless.avro.decode(encoded) }
          end
          allow(WaterDrop::SyncProducer).to receive(:call) do |data, **args|
            @messages << { args: args, type: :sync }.merge(decode[data])
            nil
          end
          allow(WaterDrop::AsyncProducer).to receive(:call) do |data, **args|
            @messages << { args: args, type: :async }.merge(decode[data])
            nil
          end
        end
def listen_to_messages decode = proc do | encoded | { encoded_data : encoded , data : Rimless . avro . decode ( encoded ) } end allow ( WaterDrop :: SyncProducer ) . to receive ( :call ) do | data , ** args | @messages << { args : args , type : :sync } . merge ( decode [ data ] ) nil end allow ( WaterDrop :: AsyncProducer ) . to receive ( :call ) do | data , ** args | @messages << { args : args , type : :async } . merge ( decode [ data ] ) nil end end
Setup the +WaterDrop+ spies and record each sent message.
Setup the + WaterDrop + spies and record each sent message .