Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
0c638b34
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,发现更多精彩内容 >>
提交
0c638b34
编写于
9月 26, 2009
作者:
J
Joshua Peek
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Clean up session integration tests so they don't reference AC::Dispatcher
上级
db65bb5a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
52 deletion
+15
-52
actionpack/test/activerecord/active_record_store_test.rb
actionpack/test/activerecord/active_record_store_test.rb
+6
-21
actionpack/test/dispatch/session/cookie_store_test.rb
actionpack/test/dispatch/session/cookie_store_test.rb
+6
-19
actionpack/test/dispatch/session/mem_cache_store_test.rb
actionpack/test/dispatch/session/mem_cache_store_test.rb
+3
-12
未找到文件。
actionpack/test/activerecord/active_record_store_test.rb
浏览文件 @
0c638b34
...
...
@@ -33,7 +33,6 @@ def rescue_action(e) raise end
def
setup
ActiveRecord
::
SessionStore
.
session_class
.
create_table!
reset_app!
end
def
teardown
...
...
@@ -132,9 +131,7 @@ def test_prevents_session_fixation
end
def
test_allows_session_fixation
with_test_route_set
do
reset_with_fixation!
with_test_route_set
(
:cookie_only
=>
false
)
do
get
'/set_session_value'
assert_response
:success
assert
cookies
[
'_session_id'
]
...
...
@@ -145,8 +142,6 @@ def test_allows_session_fixation
session_id
=
cookies
[
'_session_id'
]
assert
session_id
reset_with_fixation!
get
'/set_session_value'
,
:_session_id
=>
session_id
,
:foo
=>
"baz"
assert_response
:success
assert_equal
session_id
,
cookies
[
'_session_id'
]
...
...
@@ -159,24 +154,14 @@ def test_allows_session_fixation
end
private
def
reset_app!
app
=
ActiveRecord
::
SessionStore
.
new
(
ActionController
::
Dispatcher
.
new
,
:key
=>
'_session_id'
)
@integration_session
=
open_session
(
app
)
end
def
reset_with_fixation!
app
=
ActiveRecord
::
SessionStore
.
new
(
ActionController
::
Dispatcher
.
new
,
:key
=>
'_session_id'
,
:cookie_only
=>
false
)
@integration_session
=
open_session
(
app
)
end
def
with_test_route_set
def
with_test_route_set
(
options
=
{})
with_routing
do
|
set
|
set
.
draw
do
|
map
|
map
.
with_options
:controller
=>
"active_record_store_test/test"
do
|
c
|
c
.
connect
"/:action"
end
map
.
connect
"/:action"
,
:controller
=>
"active_record_store_test/test"
end
reset_app!
options
=
{
:key
=>
'_session_id'
}.
merge
(
options
)
app
=
ActiveRecord
::
SessionStore
.
new
(
set
,
options
)
@integration_session
=
open_session
(
app
)
yield
end
end
...
...
actionpack/test/dispatch/session/cookie_store_test.rb
浏览文件 @
0c638b34
...
...
@@ -46,10 +46,6 @@ def raise_data_overflow
def
rescue_action
(
e
)
raise
end
end
def
setup
reset_app!
end
def
test_raises_argument_error_if_missing_session_key
assert_raise
(
ArgumentError
,
nil
.
inspect
)
{
ActionDispatch
::
Session
::
CookieStore
.
new
(
nil
,
...
...
@@ -193,10 +189,7 @@ def test_persistent_session_id
end
def
test_session_store_with_expire_after
with_test_route_set
do
app
=
ActionDispatch
::
Session
::
CookieStore
.
new
(
ActionController
::
Dispatcher
.
new
,
:key
=>
SessionKey
,
:secret
=>
SessionSecret
,
:expire_after
=>
5
.
hours
)
@integration_session
=
open_session
(
app
)
with_test_route_set
(
:expire_after
=>
5
.
hours
)
do
# First request accesses the session
time
=
Time
.
local
(
2008
,
4
,
24
)
Time
.
stubs
(
:now
).
returns
(
time
)
...
...
@@ -226,20 +219,14 @@ def test_session_store_with_expire_after
end
private
def
reset_app!
app
=
ActionDispatch
::
Session
::
CookieStore
.
new
(
ActionController
::
Dispatcher
.
new
,
:key
=>
SessionKey
,
:secret
=>
SessionSecret
)
@integration_session
=
open_session
(
app
)
end
def
with_test_route_set
def
with_test_route_set
(
options
=
{})
with_routing
do
|
set
|
set
.
draw
do
|
map
|
map
.
with_options
:controller
=>
"cookie_store_test/test"
do
|
c
|
c
.
connect
"/:action"
end
map
.
connect
"/:action"
,
:controller
=>
"cookie_store_test/test"
end
reset_app!
options
=
{
:key
=>
SessionKey
,
:secret
=>
SessionSecret
}.
merge
(
options
)
app
=
ActionDispatch
::
Session
::
CookieStore
.
new
(
set
,
options
)
@integration_session
=
open_session
(
app
)
yield
end
end
...
...
actionpack/test/dispatch/session/mem_cache_store_test.rb
浏览文件 @
0c638b34
...
...
@@ -32,8 +32,6 @@ def rescue_action(e) raise end
end
begin
App
=
ActionDispatch
::
Session
::
MemCacheStore
.
new
(
ActionController
::
Dispatcher
.
new
,
:key
=>
'_session_id'
)
def
test_setting_and_getting_session_value
with_test_route_set
do
get
'/set_session_value'
...
...
@@ -107,20 +105,13 @@ def test_prevents_session_fixation
end
private
def
reset_app!
app
=
ActionDispatch
::
Session
::
MemCacheStore
.
new
(
ActionController
::
Dispatcher
.
new
,
:key
=>
'_session_id'
)
@integration_session
=
open_session
(
app
)
end
def
with_test_route_set
with_routing
do
|
set
|
set
.
draw
do
|
map
|
map
.
with_options
:controller
=>
"mem_cache_store_test/test"
do
|
c
|
c
.
connect
"/:action"
end
map
.
connect
"/:action"
,
:controller
=>
"mem_cache_store_test/test"
end
reset_app!
app
=
ActionDispatch
::
Session
::
MemCacheStore
.
new
(
set
,
:key
=>
'_session_id'
)
@integration_session
=
open_session
(
app
)
yield
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录