Sha256: ebc31d6469db0afbf5a7ab72b5a521012b50846a51e5620aa55a1c063efd88ed

Contents?: true

Size: 1022 Bytes

Versions: 1

Compression:

Stored size: 1022 Bytes

Contents

require_relative '../spec_helper'
require_relative '../../lib/kamerling/addr'
require_relative '../../lib/kamerling/handler'
require_relative '../../lib/kamerling/message'
require_relative '../../lib/kamerling/receiver'
require_relative '../../lib/kamerling/registrar'
require_relative '../../lib/kamerling/uuid'

module Kamerling
  describe Handler do
    describe '#handle' do
      fake :receiver,  as: :class
      fake :registrar, as: :class

      let(:addr)    { Addr.new                                              }
      let(:handler) { Handler.new(receiver: receiver, registrar: registrar) }

      it 'handles RGST inputs' do
        message = Message.parse('RGST')
        handler.handle message, addr
        registrar.must_have_received :register, [addr: addr, message: message]
      end

      it 'handles RSLT inputs' do
        message = Message.parse('RSLT')
        handler.handle message, addr
        receiver.must_have_received :receive, [addr: addr, message: message]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kamerling-0.0.3 spec/kamerling/handler_spec.rb