Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
acfeec51
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,发现更多精彩内容 >>
提交
acfeec51
编写于
9月 26, 2009
作者:
J
Joshua Peek
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow integration test rack app to be set with "@app" ivar instead of using open_session
上级
02413baa
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
24 addition
and
28 deletion
+24
-28
actionpack/lib/action_dispatch/testing/integration.rb
actionpack/lib/action_dispatch/testing/integration.rb
+3
-2
actionpack/test/activerecord/active_record_store_test.rb
actionpack/test/activerecord/active_record_store_test.rb
+5
-8
actionpack/test/controller/integration_test.rb
actionpack/test/controller/integration_test.rb
+1
-1
actionpack/test/controller/rescue_test.rb
actionpack/test/controller/rescue_test.rb
+2
-5
actionpack/test/controller/webservice_test.rb
actionpack/test/controller/webservice_test.rb
+2
-2
actionpack/test/dispatch/session/cookie_store_test.rb
actionpack/test/dispatch/session/cookie_store_test.rb
+2
-2
actionpack/test/dispatch/session/mem_cache_store_test.rb
actionpack/test/dispatch/session/mem_cache_store_test.rb
+3
-3
actionpack/test/dispatch/show_exceptions_test.rb
actionpack/test/dispatch/show_exceptions_test.rb
+4
-4
railties/lib/rails/console_app.rb
railties/lib/rails/console_app.rb
+2
-1
未找到文件。
actionpack/lib/action_dispatch/testing/integration.rb
浏览文件 @
acfeec51
...
...
@@ -168,8 +168,8 @@ def cookies
attr_accessor
:request_count
# Create and initialize a new Session instance.
def
initialize
(
app
=
nil
)
@app
=
app
||
ActionController
::
Dispatcher
.
new
def
initialize
(
app
)
@app
=
app
reset!
end
...
...
@@ -354,6 +354,7 @@ def reset!
# can use this method to open multiple sessions that ought to be tested
# simultaneously.
def
open_session
(
app
=
nil
)
app
||=
@app
||=
ActionController
::
Dispatcher
.
new
session
=
Integration
::
Session
.
new
(
app
)
# delegate the fixture accessors back to the test instance
...
...
actionpack/test/activerecord/active_record_store_test.rb
浏览文件 @
acfeec51
...
...
@@ -119,14 +119,10 @@ def test_prevents_session_fixation
reset!
get
'/set_session_value'
,
:_session_id
=>
session_id
,
:foo
=>
"baz"
assert_response
:success
assert_equal
nil
,
cookies
[
'_session_id'
]
get
'/get_session_value'
,
:_session_id
=>
session_id
assert_response
:success
assert_equal
'foo: nil'
,
response
.
body
assert_
equal
nil
,
cookies
[
'_session_id'
]
assert_
not_equal
session_id
,
cookies
[
'_session_id'
]
end
end
...
...
@@ -142,6 +138,8 @@ def test_allows_session_fixation
session_id
=
cookies
[
'_session_id'
]
assert
session_id
reset!
get
'/set_session_value'
,
:_session_id
=>
session_id
,
:foo
=>
"baz"
assert_response
:success
assert_equal
session_id
,
cookies
[
'_session_id'
]
...
...
@@ -159,9 +157,8 @@ def with_test_route_set(options = {})
set
.
draw
do
|
map
|
map
.
connect
"/:action"
,
:controller
=>
"active_record_store_test/test"
end
options
=
{
:key
=>
'_session_id'
}.
merge
(
options
)
app
=
ActiveRecord
::
SessionStore
.
new
(
set
,
options
)
@integration_session
=
open_session
(
app
)
@app
=
ActiveRecord
::
SessionStore
.
new
(
set
,
options
.
reverse_merge
(
:key
=>
'_session_id'
))
reset!
yield
end
end
...
...
actionpack/test/controller/integration_test.rb
浏览文件 @
acfeec51
...
...
@@ -394,7 +394,7 @@ def self.call(env)
end
def
setup
@
integration_session
=
ActionController
::
Integration
::
Session
.
new
(
Poller
)
@
app
=
Poller
end
def
test_successful_get
...
...
actionpack/test/controller/rescue_test.rb
浏览文件 @
acfeec51
...
...
@@ -326,19 +326,16 @@ def show_errors(exception)
end
test
'rescue routing exceptions'
do
app
=
ActionDispatch
::
Rescue
.
new
(
ActionController
::
Routing
::
Routes
)
do
@
app
=
ActionDispatch
::
Rescue
.
new
(
ActionController
::
Routing
::
Routes
)
do
rescue_from
ActionController
::
RoutingError
,
lambda
{
|
env
|
[
200
,
{
"Content-Type"
=>
"text/html"
},
"Gotcha!"
]
}
end
@integration_session
=
open_session
(
app
)
get
'/b00m'
assert_equal
"Gotcha!"
,
response
.
body
end
test
'unrescued exception'
do
app
=
ActionDispatch
::
Rescue
.
new
(
ActionController
::
Routing
::
Routes
)
@integration_session
=
open_session
(
app
)
@app
=
ActionDispatch
::
Rescue
.
new
(
ActionController
::
Routing
::
Routes
)
assert_raise
(
ActionController
::
RoutingError
)
{
get
'/b00m'
}
end
...
...
actionpack/test/controller/webservice_test.rb
浏览文件 @
acfeec51
...
...
@@ -245,8 +245,8 @@ def test_typecast_as_yaml
private
def
with_params_parsers
(
parsers
=
{})
old_session
=
@integration_session
app
=
ActionDispatch
::
ParamsParser
.
new
(
ActionController
::
Routing
::
Routes
,
parsers
)
@integration_session
=
open_session
(
app
)
@
app
=
ActionDispatch
::
ParamsParser
.
new
(
ActionController
::
Routing
::
Routes
,
parsers
)
reset!
yield
ensure
@integration_session
=
old_session
...
...
actionpack/test/dispatch/session/cookie_store_test.rb
浏览文件 @
acfeec51
...
...
@@ -222,8 +222,8 @@ def with_test_route_set(options = {})
map
.
connect
"/:action"
,
:controller
=>
"cookie_store_test/test"
end
options
=
{
:key
=>
SessionKey
,
:secret
=>
SessionSecret
}.
merge
(
options
)
app
=
ActionDispatch
::
Session
::
CookieStore
.
new
(
set
,
options
)
@integration_session
=
open_session
(
app
)
@
app
=
ActionDispatch
::
Session
::
CookieStore
.
new
(
set
,
options
)
reset!
yield
end
end
...
...
actionpack/test/dispatch/session/mem_cache_store_test.rb
浏览文件 @
acfeec51
...
...
@@ -101,7 +101,7 @@ def test_prevents_session_fixation
get
'/set_session_value'
,
:_session_id
=>
session_id
assert_response
:success
assert_
equal
nil
,
cookies
[
'_session_id'
]
assert_
not_equal
session_id
,
cookies
[
'_session_id'
]
end
end
rescue
LoadError
,
RuntimeError
...
...
@@ -114,8 +114,8 @@ def with_test_route_set
set
.
draw
do
|
map
|
map
.
connect
"/:action"
,
:controller
=>
"mem_cache_store_test/test"
end
app
=
ActionDispatch
::
Session
::
MemCacheStore
.
new
(
set
,
:key
=>
'_session_id'
)
@integration_session
=
open_session
(
app
)
@
app
=
ActionDispatch
::
Session
::
MemCacheStore
.
new
(
set
,
:key
=>
'_session_id'
)
reset!
yield
end
end
...
...
actionpack/test/dispatch/show_exceptions_test.rb
浏览文件 @
acfeec51
...
...
@@ -35,7 +35,7 @@ class ShowExceptionsTest < ActionController::IntegrationTest
DevelopmentApp
=
ActionDispatch
::
ShowExceptions
.
new
(
Boomer
,
true
)
test
"rescue in public from a remote ip"
do
@
integration_session
=
open_session
(
ProductionApp
)
@
app
=
ProductionApp
self
.
remote_addr
=
'208.77.188.166'
get
"/"
...
...
@@ -52,7 +52,7 @@ class ShowExceptionsTest < ActionController::IntegrationTest
end
test
"rescue locally from a local request"
do
@
integration_session
=
open_session
(
ProductionApp
)
@
app
=
ProductionApp
self
.
remote_addr
=
'127.0.0.1'
get
"/"
...
...
@@ -73,7 +73,7 @@ class ShowExceptionsTest < ActionController::IntegrationTest
old_locale
,
I18n
.
locale
=
I18n
.
locale
,
:da
begin
@
integration_session
=
open_session
(
ProductionApp
)
@
app
=
ProductionApp
self
.
remote_addr
=
'208.77.188.166'
get
"/"
...
...
@@ -89,7 +89,7 @@ class ShowExceptionsTest < ActionController::IntegrationTest
end
test
"always rescue locally in development mode"
do
@
integration_session
=
open_session
(
DevelopmentApp
)
@
app
=
DevelopmentApp
self
.
remote_addr
=
'208.77.188.166'
get
"/"
...
...
railties/lib/rails/console_app.rb
浏览文件 @
acfeec51
...
...
@@ -17,7 +17,8 @@ def app(create=false)
# create a new session. If a block is given, the new session will be yielded
# to the block before being returned.
def
new_session
session
=
ActionController
::
Integration
::
Session
.
new
app
=
ActionController
::
Dispatcher
.
new
session
=
ActionController
::
Integration
::
Session
.
new
(
app
)
yield
session
if
block_given?
session
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录