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

Version Path
deimos-ruby-2.0.0.pre.beta3 spec/schema_backends/avro_local_spec.rb
deimos-ruby-2.0.0.pre.beta2 spec/schema_backends/avro_local_spec.rb
deimos-ruby-2.0.0.pre.beta1 spec/schema_backends/avro_local_spec.rb
deimos-ruby-2.0.0.pre.alpha7 spec/schema_backends/avro_local_spec.rb
deimos-ruby-2.0.0.pre.alpha6 spec/schema_backends/avro_local_spec.rb
deimos-ruby-2.0.0.pre.alpha5 spec/schema_backends/avro_local_spec.rb
deimos-ruby-2.0.0.pre.alpha4 spec/schema_backends/avro_local_spec.rb
deimos-ruby-2.0.0.pre.alpha3 spec/schema_backends/avro_local_spec.rb
deimos-ruby-2.0.0.pre.alpha2 spec/schema_backends/avro_local_spec.rb
deimos-ruby-2.0.0.pre.alpha1 spec/schema_backends/avro_local_spec.rb
deimos-ruby-1.24.2 spec/schema_backends/avro_local_spec.rb
deimos-ruby-1.24.1 spec/schema_backends/avro_local_spec.rb
deimos-ruby-1.24.0 spec/schema_backends/avro_local_spec.rb
deimos-ruby-1.23.3 spec/schema_backends/avro_local_spec.rb
deimos-ruby-1.23.2 spec/schema_backends/avro_local_spec.rb
deimos-ruby-1.23.1.pre.beta6 spec/schema_backends/avro_local_spec.rb
deimos-ruby-1.23.1.pre.beta5 spec/schema_backends/avro_local_spec.rb
deimos-ruby-1.23.1.pre.beta4 spec/schema_backends/avro_local_spec.rb
deimos-ruby-1.23.1.pre.beta3 spec/schema_backends/avro_local_spec.rb
deimos-ruby-1.23.1.pre.beta2 spec/schema_backends/avro_local_spec.rb