Sha256: faec2ec3b80d57b45be8cc8fc133f2e0a6e7cc9547eedf1852f9895d9ec2cb23

Contents?: true

Size: 743 Bytes

Versions: 1

Compression:

Stored size: 743 Bytes

Contents

require 'net/http'
require 'uri'
require_relative '../../spec_helper'
require_relative '../../../lib/kamerling/server/http'

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

1 entries across 1 versions & 1 rubygems

Version Path
kamerling-0.0.3 spec/kamerling/server/http_spec.rb