Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
31639eab
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,发现更多精彩内容 >>
未验证
提交
31639eab
编写于
5月 23, 2016
作者:
R
Rafael Mendonça França
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove deprecated `xml_http_request` and `xhr` methods
上级
7093ceb4
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
4 addition
and
30 deletion
+4
-30
actionpack/CHANGELOG.md
actionpack/CHANGELOG.md
+4
-0
actionpack/lib/action_controller/test_case.rb
actionpack/lib/action_controller/test_case.rb
+0
-15
actionpack/test/controller/test_case_test.rb
actionpack/test/controller/test_case_test.rb
+0
-15
未找到文件。
actionpack/CHANGELOG.md
浏览文件 @
31639eab
*
Remove deprecated
`xml_http_request`
and
`xhr`
methods in
`ActionController::TestCase`
.
*Rafael Mendonça França*
*
Remove deprecated methods in
`ActionController::Parameters`
.
*Rafael Mendonça França*
...
...
actionpack/lib/action_controller/test_case.rb
浏览文件 @
31639eab
...
...
@@ -422,21 +422,6 @@ def head(action, *args)
process_with_kwargs
(
"HEAD"
,
action
,
*
args
)
end
def
xml_http_request
(
*
args
)
ActiveSupport
::
Deprecation
.
warn
(
<<-
MSG
.
strip_heredoc
)
xhr and xml_http_request methods are deprecated in favor of
`get :index, xhr: true` and `post :create, xhr: true`
MSG
@request
.
env
[
"HTTP_X_REQUESTED_WITH"
]
=
"XMLHttpRequest"
@request
.
env
[
"HTTP_ACCEPT"
]
||=
[
Mime
[
:js
],
Mime
[
:html
],
Mime
[
:xml
],
"text/xml"
,
"*/*"
].
join
(
", "
)
__send__
(
*
args
).
tap
do
@request
.
env
.
delete
"HTTP_X_REQUESTED_WITH"
@request
.
env
.
delete
"HTTP_ACCEPT"
end
end
alias
xhr
:xml_http_request
# Simulate an HTTP request to +action+ by specifying request method,
# parameters and set/volley the response.
#
...
...
actionpack/test/controller/test_case_test.rb
浏览文件 @
31639eab
...
...
@@ -742,12 +742,6 @@ def test_header_properly_reset_after_remote_http_request
assert_nil
@request
.
env
[
"HTTP_ACCEPT"
]
end
def
test_deprecated_xhr_with_params
assert_deprecated
{
xhr
:get
,
:test_params
,
params:
{
id:
1
}
}
assert_equal
({
"id"
=>
"1"
,
"controller"
=>
"test_case_test/test"
,
"action"
=>
"test_params"
},
::
JSON
.
parse
(
@response
.
body
))
end
def
test_xhr_with_params
get
:test_params
,
params:
{
id:
1
},
xhr:
true
...
...
@@ -763,15 +757,6 @@ def test_xhr_with_session
assert_equal
"it works"
,
session
[
:symbol
],
"Test session hash should allow indifferent access"
end
def
test_deprecated_xhr_with_session
assert_deprecated
{
xhr
:get
,
:set_session
}
assert_equal
"A wonder"
,
session
[
"string"
],
"A value stored in the session should be available by string key"
assert_equal
"A wonder"
,
session
[
:string
],
"Test session hash should allow indifferent access"
assert_equal
"it works"
,
session
[
"symbol"
],
"Test session hash should allow indifferent access"
assert_equal
"it works"
,
session
[
:symbol
],
"Test session hash should allow indifferent access"
end
def
test_deprecated_params_reset_between_post_requests
assert_deprecated
{
post
:no_op
,
foo:
"bar"
}
assert_equal
"bar"
,
@request
.
params
[
:foo
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录