bf1558eeb0
### Summary The `server` package implements a static file web server intended to be used during development. The goal is to have it as close to a production environment as possible. Not there yet. This is the first step.
23 lines
475 B
Ruby
23 lines
475 B
Ruby
require_relative "setup"
|
|
require "rack/test"
|
|
|
|
class ServerDirTest < Test::Unit::TestCase
|
|
include Rack::Test::Methods
|
|
|
|
def test_index
|
|
get "/"
|
|
assert_equal 200, last_response.status
|
|
assert_equal "text/html", last_response.content_type
|
|
assert_equal bytesize("./test/fakeweb/index.html"), last_response.content_length
|
|
end
|
|
|
|
private
|
|
|
|
def app
|
|
@app ||= Server.app("./test/fakeweb/")
|
|
end
|
|
|
|
def bytesize(path)
|
|
File.binread(path).bytesize
|
|
end
|
|
end
|