spec/kamerling/server/http_spec.rb in kamerling-0.0.2 vs spec/kamerling/server/http_spec.rb in kamerling-0.0.3
- old
+ new
@@ -1,22 +1,27 @@
+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] }
+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
+ 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
- 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
+ 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 end
+end