Sha256: 338c03c6cc17af96239d5f53786bc369ee5d5d38290f8e47c88ec8f1edf47c8e

Contents?: true

Size: 997 Bytes

Versions: 28

Compression:

Stored size: 997 Bytes

Contents

# frozen_string_literal: true

require 'avro_turf/messaging'

describe Deimos::AvroDataEncoder do

  let(:encoder) do
    encoder = described_class.new(schema: 'MySchema',
                                  namespace: 'com.my-namespace')
    allow(encoder).to(receive(:encode)) { |payload| payload }
    encoder
  end

  specify 'generate_key_schema' do
    expect_any_instance_of(AvroTurf::SchemaStore).
      to receive(:add_schema).with(
        'type' => 'record',
        'name' => 'MySchema_key',
        'namespace' => 'com.my-namespace',
        'doc' => 'Key for com.my-namespace.MySchema',
        'fields' => [
          {
            'name' => 'test_id',
            'type' => 'string'
          }
        ]
      )
    encoder.send(:_generate_key_schema, 'test_id')
  end

  it 'should encode a key' do
    # reset stub from TestHelpers
    allow(described_class).to receive(:new).and_call_original
    expect(encoder.encode_key('test_id', '123')).to eq('test_id' => '123')
  end

end

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
deimos-ruby-1.3.0.pre.beta5 spec/avro_data_encoder_spec.rb
deimos-ruby-1.4.0.pre.beta7 spec/avro_data_encoder_spec.rb
deimos-ruby-1.4.0.pre.beta6 spec/avro_data_encoder_spec.rb
deimos-ruby-1.4.0.pre.beta5 spec/avro_data_encoder_spec.rb
deimos-ruby-1.3.0.pre.beta4 spec/avro_data_encoder_spec.rb
deimos-ruby-1.4.0.pre.beta4 spec/avro_data_encoder_spec.rb
deimos-ruby-1.4.0.pre.beta3 spec/avro_data_encoder_spec.rb
deimos-ruby-1.3.0.pre.beta3 spec/avro_data_encoder_spec.rb
deimos-ruby-1.4.0.pre.beta2 spec/avro_data_encoder_spec.rb
deimos-ruby-1.4.0.pre.beta1 spec/avro_data_encoder_spec.rb
deimos-ruby-1.3.0.pre.beta2 spec/avro_data_encoder_spec.rb
deimos-ruby-1.3.0.pre.beta1 spec/avro_data_encoder_spec.rb
deimos-ruby-1.2.0.pre.beta1 spec/avro_data_encoder_spec.rb
deimos-ruby-1.1.0.pre.beta2 spec/avro_data_encoder_spec.rb
deimos-ruby-1.1.0.pre.beta1 spec/avro_data_encoder_spec.rb
deimos-ruby-1.0.0 spec/avro_data_encoder_spec.rb
deimos-ruby-1.0.0.pre.beta26 spec/avro_data_encoder_spec.rb
deimos-ruby-1.0.0.pre.beta25 spec/avro_data_encoder_spec.rb
deimos-ruby-1.0.0.pre.beta24 spec/avro_data_encoder_spec.rb
deimos-ruby-1.0.0.pre.beta23 spec/avro_data_encoder_spec.rb