Sha256: 4eacd20e5826f7ae62b3ef16201b7a98d2292f8155af6681a43c0b94d6cd0683

Contents?: true

Size: 988 Bytes

Versions: 3

Compression:

Stored size: 988 Bytes

Contents

RSpec.describe Message::StartSaga do
  let(:sender) { SecureRandom.uuid }
  let(:id) { SecureRandom.uuid }

  let(:args) { { thing: 'puppy' } }
  let(:details) { { name: 'TestSaga', args: args } }
  let(:binary_details) { Marshal.dump details }
  let(:type_code) { Message::StartSaga::TYPE_CODE }
  let(:string) { type_code + sender + id + binary_details }

  let(:message) { Message::StartSaga.new(sender, id, details) }

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

      expect(message).to be_a Message::StartSaga
      expect(message.sender).to eq sender
      expect(message.id).to eq id
      expect(message.details).to eq details
    end
  end

  describe '#name' do
    it 'should return the correct name' do
      expect(message.name).to eq 'TestSaga'
    end
  end

  describe '#to_s' do
    it 'should serialize correctly' do
      serialized = message.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/start_saga_spec.rb
aggro-0.0.3 spec/lib/aggro/message/start_saga_spec.rb
aggro-0.0.2 spec/lib/aggro/message/start_saga_spec.rb