Sha256: f53ef5de63f596ad84bb9eea9084539c26afc1b4e6e4c782011aa77606cc1468

Contents?: true

Size: 1.04 KB

Versions: 31

Compression:

Stored size: 1.04 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

end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
deimos-ruby-1.10.0 spec/schema_backends/base_spec.rb
deimos-ruby-1.9.2 spec/schema_backends/base_spec.rb
deimos-ruby-1.9.1 spec/schema_backends/base_spec.rb
deimos-ruby-1.9.0 spec/schema_backends/base_spec.rb
deimos-ruby-1.8.7 spec/schema_backends/base_spec.rb
deimos-ruby-1.8.6 spec/schema_backends/base_spec.rb
deimos-ruby-1.8.5 spec/schema_backends/base_spec.rb
deimos-ruby-1.8.4 spec/schema_backends/base_spec.rb
deimos-ruby-1.8.3 spec/schema_backends/base_spec.rb
deimos-ruby-1.8.2 spec/schema_backends/base_spec.rb
deimos-ruby-1.8.2.pre.beta2 spec/schema_backends/base_spec.rb
deimos-ruby-1.8.2.pre.beta1 spec/schema_backends/base_spec.rb
deimos-ruby-1.8.1.pre.beta9 spec/schema_backends/base_spec.rb
deimos-ruby-1.8.1.pre.beta8 spec/schema_backends/base_spec.rb
deimos-ruby-1.8.1.pre.beta7 spec/schema_backends/base_spec.rb
deimos-ruby-1.8.1.pre.beta6 spec/schema_backends/base_spec.rb
deimos-ruby-1.8.1.pre.beta5 spec/schema_backends/base_spec.rb
deimos-ruby-1.8.1.pre.beta4 spec/schema_backends/base_spec.rb
deimos-ruby-1.8.1.pre.beta3 spec/schema_backends/base_spec.rb
deimos-ruby-1.8.1.pre.beta2 spec/schema_backends/base_spec.rb