lib/deimos/test_helpers.rb in deimos-ruby-1.3.0.pre.beta2 vs lib/deimos/test_helpers.rb in deimos-ruby-1.3.0.pre.beta3

- old
+ new

@@ -59,10 +59,11 @@ if schema && decoder.namespace # Validate against local schema. encoder = Deimos::AvroDataEncoder.new(schema: schema, namespace: decoder.namespace) encoder.schema_store = decoder.schema_store + payload = payload.respond_to?(:stringify_keys) ? payload.stringify_keys : payload encoder.encode_local(payload) end payload end allow(decoder).to receive(:decode_key) do |payload, _key_id| @@ -465,9 +466,15 @@ # Stub shared methods between consumers/batch consumers # @param [Class < Deimos::BaseConsumer] klass Consumer class to stub def _stub_base_consumer(klass) allow(klass).to receive(:decoder) do create_decoder(klass.config[:schema], klass.config[:namespace]) + end + + if klass.config[:key_schema] # rubocop:disable Style/GuardClause + allow(klass).to receive(:key_decoder) do + create_decoder(klass.config[:key_schema], klass.config[:namespace]) + end end end end end