Sha256: 138b373888bf981ca8bcd81b7c525316fa4512416d1491467d37a35b43d426cc

Contents?: true

Size: 759 Bytes

Versions: 3

Compression:

Stored size: 759 Bytes

Contents

RSpec.describe Client do
  subject(:client) { Client.new(endpoint) }

  let(:endpoint) { 'tcp://10.0.0.1:4000' }

  describe '#post' do
    let(:transport) { spy(client: transport_client) }
    let(:transport_client) { spy(post: 'hi') }

    before do
      allow(Aggro).to receive(:transport).and_return transport
      allow(MessageParser).to receive(:parse).and_return 'parsed'
    end

    it 'should start a server for the node using the current transport' do
      client.post 'hello'

      expect(transport).to have_received(:client).with(endpoint)
      expect(transport_client).to have_received(:post).with 'hello'
    end

    it 'should parse the response with MessageParser' do
      expect(client.post('hello')).to eq 'parsed'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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