Sha256: 4d22b4f18617b77239b04b5bd375cc526acffc78d51608f93d40ce7a8198c12a

Contents?: true

Size: 1.15 KB

Versions: 74

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

describe Deimos::SchemaBackends::Base do
  let(:backend) { described_class.new(schema: 'schema', namespace: 'namespace') }
  let(:payload) { { foo: 1 } }

  it 'should validate on encode' do
    expect(backend).to receive(:validate).with(payload, schema: 'schema')
    expect(backend).to receive(:encode_payload).with(payload, schema: 'schema', topic: 'topic')
    backend.encode(payload, topic: 'topic')
  end

  it 'should validate and encode a passed schema' do
    expect(backend).to receive(:validate).with(payload, schema: 'schema2')
    expect(backend).to receive(:encode_payload).with(payload, schema: 'schema2', topic: 'topic')
    backend.encode(payload, schema: 'schema2', topic: 'topic')
  end

  it 'should decode a schema' do
    expect(backend).to receive(:decode_payload).with(payload, schema: 'schema')
    backend.decode(payload)
  end

  it 'should decode a passed schema' do
    expect(backend).to receive(:decode_payload).with(payload, schema: 'schema2')
    backend.decode(payload, schema: 'schema2')
  end

  it 'should return nil if passed nil' do
    expect(backend.decode(nil, schema: 'schema2')).to be_nil
  end

end

Version data entries

74 entries across 74 versions & 2 rubygems

Version Path
deimos-ruby-1.24.2 spec/schema_backends/base_spec.rb
deimos-ruby-1.24.1 spec/schema_backends/base_spec.rb
deimos-ruby-1.24.0 spec/schema_backends/base_spec.rb
deimos-ruby-1.23.3 spec/schema_backends/base_spec.rb
deimos-ruby-1.23.2 spec/schema_backends/base_spec.rb
deimos-ruby-1.23.1.pre.beta6 spec/schema_backends/base_spec.rb
deimos-ruby-1.23.1.pre.beta5 spec/schema_backends/base_spec.rb
deimos-ruby-1.23.1.pre.beta4 spec/schema_backends/base_spec.rb
deimos-ruby-1.23.1.pre.beta3 spec/schema_backends/base_spec.rb
deimos-ruby-1.23.1.pre.beta2 spec/schema_backends/base_spec.rb
deimos-ruby-1.23.1.pre.beta1 spec/schema_backends/base_spec.rb
deimos-ruby-1.23.0 spec/schema_backends/base_spec.rb
deimos-ruby-1.22.5 spec/schema_backends/base_spec.rb
deimos-ruby-1.22.4 spec/schema_backends/base_spec.rb
deimos-ruby-1.22.3 spec/schema_backends/base_spec.rb
deimos-ruby-1.22.2 spec/schema_backends/base_spec.rb
deimos-ruby-1.22.1 spec/schema_backends/base_spec.rb
deimos-ruby-1.22 spec/schema_backends/base_spec.rb
deimos-ruby-1.20.1 spec/schema_backends/base_spec.rb
deimos-ruby-1.20.0 spec/schema_backends/base_spec.rb