Search
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Ruby
All Projects
Ruby
Overview
Activity
Roadmap
Issues
Repository
Download (811 Bytes)
Bug #3920
» test_prochandler.rb
okkez (okkez _)
, 10/08/2010 07:17 PM
require_relative
"utils"
require
"webrick"
require
"test/unit"
class
WEBrick::TestProcHandler
<
Test
::
Unit
::
TestCase
def
test_proc
config
=
{
:DocumentRoot
=>
File
.
dirname
(
__FILE__
),
}
TestWEBrick
.
start_httpserver
(
config
)
do
|
server
,
addr
,
port
,
log
|
server
.
mount
(
'/proc'
,
WEBrick
::
HTTPServlet
::
ProcHandler
,
lambda
{
|
request
,
response
|
response
.
content_type
=
"text/html"
response
.
body
=
'Hello, WEBrick!'
})
http
=
Net
::
HTTP
.
new
(
addr
,
port
)
req
=
Net
::
HTTP
::
Get
.
new
(
"/proc"
)
http
.
request
(
req
){
|
res
|
assert_equal
(
"200"
,
res
.
code
,
log
.
call
)
assert_equal
(
"text/html"
,
res
.
content_type
,
log
.
call
)
assert_match
(
/Hello, WEBrick!/
,
res
.
body
,
log
.
call
)
}
end
end
end
(1-1/1)
Loading...