Revision 07e49f8d23965e1b89ab76c9ee3441b4eb95dd3a authored by ashmaroli on 28 February 2018, 16:07:50 UTC, committed by jekyllbot on 28 February 2018, 16:07:50 UTC
Merge pull request 6767
1 parent 5748d6a
test_commands_serve_servlet.rb
# frozen_string_literal: true
require "webrick"
require "helper"
require "net/http"
class TestCommandsServeServlet < JekyllUnitTest
def get(path)
TestWEBrick.mount_server do |_server, addr, port|
http = Net::HTTP.new(addr, port)
req = Net::HTTP::Get.new(path)
http.request(req) { |response| yield(response) }
end
end
context "with a directory and file with the same name" do
should "find that file" do
get("/bar/") do |response|
assert_equal("200", response.code)
assert_equal("Content of bar.html", response.body.strip)
end
end
should "find file in directory" do
get("/bar/baz") do |response|
assert_equal("200", response.code)
assert_equal("Content of baz.html", response.body.strip)
end
end
should "return 404 for non-existing files" do
get("/bar/missing") do |response|
assert_equal("404", response.code)
end
end
end
end
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...