Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
dbb0abfb
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
dbb0abfb
编写于
8月 17, 2008
作者:
J
Joshua Peek
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More integration test coverage
上级
f2456584
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
29 addition
and
3 deletion
+29
-3
actionpack/test/controller/integration_test.rb
actionpack/test/controller/integration_test.rb
+29
-3
未找到文件。
actionpack/test/controller/integration_test.rb
浏览文件 @
dbb0abfb
...
...
@@ -265,6 +265,10 @@ def cookie_monster
cookies
[
"cookie_3"
]
=
"chocolate"
render
:text
=>
"Gone"
,
:status
=>
410
end
def
redirect
redirect_to
:action
=>
"get"
end
end
def
test_get
...
...
@@ -274,6 +278,9 @@ def test_get
assert_equal
"OK"
,
status_message
assert_equal
"200 OK"
,
response
.
headers
[
"Status"
]
assert_equal
[
"200 OK"
],
headers
[
"status"
]
assert_response
200
assert_response
:success
assert_response
:ok
assert_equal
[],
response
.
headers
[
"cookie"
]
assert_equal
[],
headers
[
"cookie"
]
assert_equal
({},
cookies
)
...
...
@@ -290,6 +297,9 @@ def test_post
assert_equal
"Created"
,
status_message
assert_equal
"201 Created"
,
response
.
headers
[
"Status"
]
assert_equal
[
"201 Created"
],
headers
[
"status"
]
assert_response
201
assert_response
:success
assert_response
:created
assert_equal
[],
response
.
headers
[
"cookie"
]
assert_equal
[],
headers
[
"cookie"
]
assert_equal
({},
cookies
)
...
...
@@ -308,6 +318,8 @@ def test_cookie_monster
assert_equal
"Gone"
,
status_message
assert_equal
"410 Gone"
,
response
.
headers
[
"Status"
]
assert_equal
[
"410 Gone"
],
headers
[
"status"
]
assert_response
410
assert_response
:gone
assert_equal
nil
,
response
.
headers
[
"Set-Cookie"
]
assert_equal
[
"cookie_1=; path=/"
,
"cookie_3=chocolate; path=/"
],
headers
[
'set-cookie'
]
assert_equal
[[],
[
"chocolate"
]],
response
.
headers
[
"cookie"
]
...
...
@@ -317,14 +329,28 @@ def test_cookie_monster
end
end
def
test_redirect
with_test_route_set
do
get
'/redirect'
assert_equal
302
,
status
assert_equal
"Found"
,
status_message
assert_equal
"302 Found"
,
response
.
headers
[
"Status"
]
assert_equal
[
"302 Found"
],
headers
[
"status"
]
assert_response
302
assert_response
:redirect
assert_response
:found
assert_equal
"<html><body>You are being <a href=
\"
http://www.example.com/get
\"
>redirected</a>.</body></html>"
,
response
.
body
assert_kind_of
HTML
::
Document
,
html_document
assert_equal
1
,
request_count
end
end
private
def
with_test_route_set
with_routing
do
|
set
|
set
.
draw
do
|
map
|
map
.
with_options
:controller
=>
"IntegrationProcessTest::Integration"
do
|
c
|
c
.
connect
'/get'
,
:action
=>
"get"
c
.
connect
'/post'
,
:action
=>
"post"
c
.
connect
'/cookie_monster'
,
:action
=>
"cookie_monster"
c
.
connect
"/:action"
end
end
yield
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录