Sha256: e43610861cf5c39f6b8a389de11546ed509ab6f281b57aa889816c93e0404cc2
Contents?: true
Size: 1022 Bytes
Versions: 115
Compression:
Stored size: 1022 Bytes
Contents
# frozen_string_literal: true require_relative 'avro_base_shared' require 'deimos/schema_backends/avro_local' RSpec.describe Deimos::SchemaBackends::AvroLocal do let(:payload) do { 'test_id' => 'some string', 'some_int' => 3 } end let(:backend) { described_class.new(schema: 'MySchema', namespace: 'com.my-namespace') } it_should_behave_like 'an Avro backend' it 'should encode and decode correctly' do avro_turf = instance_double(AvroTurf) expect(avro_turf).to receive(:encode). with(payload, schema_name: 'MySchema', namespace: 'com.my-namespace'). and_return('encoded-payload') expect(avro_turf).to receive(:decode). with('encoded-payload', schema_name: 'MySchema', namespace: 'com.my-namespace'). and_return(payload) allow(backend).to receive(:avro_turf).and_return(avro_turf) results = backend.encode(payload) expect(results).to eq('encoded-payload') results = backend.decode(results) expect(results).to eq(payload) end end
Version data entries
115 entries across 115 versions & 2 rubygems