Sha256: edb91a0c8388b59098a0af6d19824b1e070ff60a49132d7d1f8cd8b8167eb1a7

Contents?: true

Size: 912 Bytes

Versions: 3

Compression:

Stored size: 912 Bytes

Contents

RSpec.describe Message::GetEvents do
  let(:message_type) { Message::GetEvents::TYPE_CODE }
  let(:sender) { SecureRandom.uuid }
  let(:id) { SecureRandom.uuid }
  let(:from_version) { 0 }

  let(:string) { message_type + sender + id + from_version.to_s }

  describe '.parse' do
    it 'should parse correctly' do
      message = Message::GetEvents.parse string

      expect(message).to be_a Message::GetEvents
      expect(message.sender).to eq sender
      expect(message.id).to eq id
      expect(message.from_version).to eq from_version
    end
  end

  describe '#to_s' do
    it 'should serialize correctly' do
      serialized = Message::GetEvents.new(sender, id, from_version).to_s

      expect(serialized).to eq string
    end

    it 'should use 0 as a default from_version' do
      serialized = Message::GetEvents.new(sender, id, nil).to_s

      expect(serialized).to eq string
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
aggro-0.0.4 spec/lib/aggro/message/get_events_spec.rb
aggro-0.0.3 spec/lib/aggro/message/get_events_spec.rb
aggro-0.0.2 spec/lib/aggro/message/get_events_spec.rb