Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
f32cf448
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,发现更多精彩内容 >>
提交
f32cf448
编写于
5月 02, 2009
作者:
J
Joshua Peek
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Switch functional tests to run through the rack interface instead of process
上级
a8b75c48
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
28 addition
and
10 deletion
+28
-10
actionpack/lib/action_controller/base/base.rb
actionpack/lib/action_controller/base/base.rb
+8
-4
actionpack/lib/action_controller/dispatch/dispatcher.rb
actionpack/lib/action_controller/dispatch/dispatcher.rb
+1
-1
actionpack/lib/action_controller/dispatch/rescue.rb
actionpack/lib/action_controller/dispatch/rescue.rb
+1
-1
actionpack/lib/action_controller/routing/route_set.rb
actionpack/lib/action_controller/routing/route_set.rb
+1
-1
actionpack/lib/action_controller/testing/process.rb
actionpack/lib/action_controller/testing/process.rb
+11
-2
actionpack/lib/action_dispatch/testing/test_request.rb
actionpack/lib/action_dispatch/testing/test_request.rb
+5
-0
actionpack/test/controller/caching_test.rb
actionpack/test/controller/caching_test.rb
+1
-1
未找到文件。
actionpack/lib/action_controller/base/base.rb
浏览文件 @
f32cf448
...
...
@@ -371,10 +371,7 @@ def session
class
<<
self
def
call
(
env
)
# HACK: For global rescue to have access to the original request and response
request
=
env
[
"action_controller.rescue.request"
]
||=
ActionDispatch
::
Request
.
new
(
env
)
response
=
env
[
"action_controller.rescue.response"
]
||=
ActionDispatch
::
Response
.
new
process
(
request
,
response
)
new
.
call
(
env
)
end
# Factory for the standard create, process loop where the controller is discarded after processing.
...
...
@@ -511,6 +508,13 @@ def exempt_from_layout(*types)
end
public
def
call
(
env
)
# HACK: For global rescue to have access to the original request and response
request
=
env
[
"action_dispatch.rescue.request"
]
||=
ActionDispatch
::
Request
.
new
(
env
)
response
=
env
[
"action_dispatch.rescue.response"
]
||=
ActionDispatch
::
Response
.
new
process
(
request
,
response
).
to_a
end
# Extracts the action_name from the request parameters and performs that action.
def
process
(
request
,
response
,
method
=
:perform_action
,
*
arguments
)
#:nodoc:
response
.
request
=
request
...
...
actionpack/lib/action_controller/dispatch/dispatcher.rb
浏览文件 @
f32cf448
...
...
@@ -80,7 +80,7 @@ def _call(env)
Routing
::
Routes
.
call
(
env
)
rescue
Exception
=>
exception
if
controller
||=
(
::
ApplicationController
rescue
Base
)
controller
.
call_with_exception
(
env
,
exception
)
.
to_a
controller
.
call_with_exception
(
env
,
exception
)
else
raise
exception
end
...
...
actionpack/lib/action_controller/dispatch/rescue.rb
浏览文件 @
f32cf448
...
...
@@ -62,7 +62,7 @@ module ClassMethods
def
call_with_exception
(
env
,
exception
)
#:nodoc:
request
=
env
[
"action_controller.rescue.request"
]
||=
ActionDispatch
::
Request
.
new
(
env
)
response
=
env
[
"action_controller.rescue.response"
]
||=
ActionDispatch
::
Response
.
new
new
.
process
(
request
,
response
,
:rescue_action
,
exception
)
new
.
process
(
request
,
response
,
:rescue_action
,
exception
)
.
to_a
end
end
...
...
actionpack/lib/action_controller/routing/route_set.rb
浏览文件 @
f32cf448
...
...
@@ -430,7 +430,7 @@ def raise_named_route_error(options, named_route, named_route_name)
def
call
(
env
)
request
=
ActionDispatch
::
Request
.
new
(
env
)
app
=
Routing
::
Routes
.
recognize
(
request
)
app
.
call
(
env
)
.
to_a
app
.
call
(
env
)
end
def
recognize
(
request
)
...
...
actionpack/lib/action_controller/testing/process.rb
浏览文件 @
f32cf448
...
...
@@ -35,12 +35,13 @@ def assign_parameters(controller_path, action, parameters)
end
data
=
params
.
to_query
@env
[
'CONTENT_LENGTH'
]
=
data
.
length
@env
[
'CONTENT_LENGTH'
]
=
data
.
length
.
to_s
@env
[
'rack.input'
]
=
StringIO
.
new
(
data
)
end
def
recycle!
@env
.
delete_if
{
|
k
,
v
|
k
=~
/^(action_dispatch|rack)\.request/
}
@env
.
delete_if
{
|
k
,
v
|
k
=~
/^action_dispatch\.rescue/
}
@env
[
'action_dispatch.request.query_parameters'
]
=
{}
end
end
...
...
@@ -132,7 +133,15 @@ def process(action, parameters = nil, session = nil, flash = nil, http_method =
Base
.
class_eval
{
include
ProcessWithTest
}
unless
Base
<
ProcessWithTest
response
=
Rack
::
MockResponse
.
new
(
*
@controller
.
process
(
@request
,
ActionDispatch
::
Response
.
new
).
to_a
)
env
=
@request
.
env
app
=
@controller
# TODO: Enable Lint
# app = Rack::Lint.new(app)
status
,
headers
,
body
=
app
.
call
(
env
)
response
=
Rack
::
MockResponse
.
new
(
status
,
headers
,
body
)
@response
.
request
,
@response
.
template
=
@request
,
@controller
.
template
@response
.
status
,
@response
.
headers
,
@response
.
body
=
response
.
status
,
response
.
headers
,
response
.
body
@response
...
...
actionpack/lib/action_dispatch/testing/test_request.rb
浏览文件 @
f32cf448
...
...
@@ -16,6 +16,7 @@ def initialize(env = {})
def
env
write_cookies!
delete_nil_values!
super
end
...
...
@@ -74,5 +75,9 @@ def write_cookies!
@env
[
'HTTP_COOKIE'
]
=
@cookies
.
map
{
|
name
,
value
|
"
#{
name
}
=
#{
value
}
;"
}.
join
(
' '
)
end
end
def
delete_nil_values!
@env
.
delete_if
{
|
k
,
v
|
v
.
nil?
}
end
end
end
actionpack/test/controller/caching_test.rb
浏览文件 @
f32cf448
...
...
@@ -111,7 +111,7 @@ def test_should_cache_with_trailing_slash_on_url
end
def
test_should_cache_ok_at_custom_path
@request
.
stubs
(
:path
).
returns
(
"/index.html"
)
@request
.
request_uri
=
"/index.html"
get
:ok
assert_response
:ok
assert
File
.
exist?
(
"
#{
FILE_STORE_PATH
}
/index.html"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录