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