Sha256: e320c677473f10cd9b7f957562c69b266aebb38f2f7ef8c089f14da59b077287

Contents?: true

Size: 619 Bytes

Versions: 2

Compression:

Stored size: 619 Bytes

Contents

require_relative '../../spec_helper'

module Kamerling describe Server::HTTP do
  let(:addr) { Addr['localhost', 2009, :TCP] }

  describe '#addr' do
    it 'returns the server’s host + port as a TCP addr' do
      Server::HTTP.new(addr: addr).addr.must_equal addr
    end
  end

  describe '#start, #stop' do
    it 'starts/stops a HTTP server on the given host and port' do
      capture_io do
        server = Server::HTTP.new(addr: addr).start
        uri = URI.parse 'http://localhost:2009'
        Net::HTTP.get_response(uri).must_be_kind_of Net::HTTPSuccess
        server.stop
      end
    end
  end
end end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kamerling-0.0.2 spec/kamerling/server/http_spec.rb
kamerling-0.0.1 spec/kamerling/server/http_spec.rb