ruby-changes:49282
From: normal <ko1@a...>
Date: Fri, 22 Dec 2017 10:07:55 +0900 (JST)
Subject: [ruby-changes:49282] normal:r61399 (trunk): webrick: add test for WEBrick::HTTPServlet::ERBHandler
normal 2017-12-22 10:07:50 +0900 (Fri, 22 Dec 2017) New Revision: 61399 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61399 Log: 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] Added files: trunk/test/webrick/webrick.rhtml Modified files: trunk/test/webrick/test_filehandler.rb Index: test/webrick/webrick.rhtml =================================================================== --- test/webrick/webrick.rhtml (nonexistent) +++ test/webrick/webrick.rhtml (revision 61399) @@ -0,0 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/test/webrick/webrick.rhtml#L1 +req to <%= +servlet_request.request_uri +%> <%= +servlet_request.query.inspect %> Index: test/webrick/test_filehandler.rb =================================================================== --- test/webrick/test_filehandler.rb (revision 61398) +++ test/webrick/test_filehandler.rb (revision 61399) @@ -321,4 +321,20 @@ class WEBrick::TestFileHandler < Test::U https://github.com/ruby/ruby/blob/trunk/test/webrick/test_filehandler.rb#L321 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/