File: server.rb

package info (click to toggle)
ruby-async-http 0.94.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 916 kB
  • sloc: ruby: 5,224; javascript: 40; makefile: 4
file content (26 lines) | stat: -rw-r--r-- 568 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2024, by Samuel Williams.

require "async/http/server"
require "async/http/endpoint"
require "sus/fixtures/async"

describe Async::HTTP::Server do
	include Sus::Fixtures::Async::ReactorContext
	
	let(:endpoint) {Async::HTTP::Endpoint.parse("http://localhost:0")}
	let(:app) {Protocol::HTTP::Middleware::Okay}
	let(:server) {subject.new(app, endpoint)}
	
	with "#run" do
		it "runs the server" do
			task = server.run
			
			expect(task).to be_a(Async::Task)
			
			task.stop
		end
	end
end