webrick: add test for WEBrick::HTTPServlet::ERBHandler

This previously had no coverage.

* test/webrick/test_filehandler.rb (test_erbhandler): new test
* test/webrick/webrick.rhtml: new file for test
  [Misc #14216]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
normal 2017-12-22 01:07:50 +00:00
Родитель 646b83af2a
Коммит 1895a48856
2 изменённых файлов: 20 добавлений и 0 удалений

Просмотреть файл

@ -321,4 +321,20 @@ class WEBrick::TestFileHandler < Test::Unit::TestCase
http.request(req, &response_assertion)
end
end
def test_erbhandler
config = { :DocumentRoot => File.dirname(__FILE__) }
log_tester = lambda {|log, access_log|
log = log.reject {|s| /ERROR `.*\' not found\./ =~ s }
assert_equal([], log)
}
TestWEBrick.start_httpserver(config, log_tester) do |server, addr, port, log|
http = Net::HTTP.new(addr, port)
req = Net::HTTP::Get.new("/webrick.rhtml")
http.request(req) do |res|
assert_equal("200", res.code, log.call)
assert_match %r!\Areq to http://[^/]+/webrick\.rhtml {}\n!, res.body
end
end
end
end

Просмотреть файл

@ -0,0 +1,4 @@
req to <%=
servlet_request.request_uri
%> <%=
servlet_request.query.inspect %>