Sha256: 0e9927c9d791d139adb83444648864e55132e1c88c47d08d483fc8595677df4c
Contents?: true
Size: 1.23 KB
Versions: 20
Compression:
Stored size: 1.23 KB
Contents
# frozen_string_literal: true RSpec.describe(Deimos::Message) do it 'should detect tombstones' do expect(described_class.new(nil, key: 'key1')). to be_tombstone expect(described_class.new({ v: 'val1' }, key: 'key1')). not_to be_tombstone expect(described_class.new({ v: '' }, key: 'key1')). not_to be_tombstone expect(described_class.new({ v: 'val1' }, key: nil)). not_to be_tombstone end it 'can support complex keys/values' do expect { described_class.new({ a: 1, b: 2 }, key: { c: 3, d: 4 }) }. not_to raise_exception end describe 'headers' do it 'returns nil when not set' do expect(described_class.new({ v: 'val1' }, key: 'key1')). to have_attributes(headers: nil) end it 'can set and get headers' do expect(described_class.new({ v: 'val1' }, key: 'key1', headers: { a: 1 })). to have_attributes(headers: { a: 1 }) end it 'includes headers when converting to Hash' do expect(described_class.new({ v: 'val1' }, key: 'key1', headers: { a: 1 }).to_h). to include(headers: { a: 1 }) expect(described_class.new({ v: 'val1' }, key: 'key1', headers: { a: 1 }).encoded_hash). to include(headers: { a: 1 }) end end end
Version data entries
20 entries across 20 versions & 1 rubygems