Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
9532d746
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,发现更多精彩内容 >>
提交
9532d746
编写于
9月 05, 2010
作者:
C
Carlos Antonio da Silva
提交者:
José Valim
9月 06, 2010
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cleanup deprecations in Action Dispatch
Signed-off-by:
N
José Valim
<
jose.valim@gmail.com
>
上级
11fccc5f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
8 addition
and
135 deletion
+8
-135
actionpack/lib/action_dispatch/http/url.rb
actionpack/lib/action_dispatch/http/url.rb
+1
-8
actionpack/lib/action_dispatch/middleware/stack.rb
actionpack/lib/action_dispatch/middleware/stack.rb
+0
-5
actionpack/lib/action_dispatch/testing/test_response.rb
actionpack/lib/action_dispatch/testing/test_response.rb
+0
-93
actionpack/lib/action_view/helpers/atom_feed_helper.rb
actionpack/lib/action_view/helpers/atom_feed_helper.rb
+1
-1
actionpack/test/controller/action_pack_assertions_test.rb
actionpack/test/controller/action_pack_assertions_test.rb
+6
-21
actionpack/test/controller/test_test.rb
actionpack/test/controller/test_test.rb
+0
-7
未找到文件。
actionpack/lib/action_dispatch/http/url.rb
浏览文件 @
9532d746
...
...
@@ -95,13 +95,6 @@ def subdomain(tld_length = 1)
subdomains
(
tld_length
).
join
(
'.'
)
end
# Returns the request URI, accounting for server idiosyncrasies.
# WEBrick includes the full \URL. IIS leaves REQUEST_URI blank.
def
request_uri
ActiveSupport
::
Deprecation
.
warn
"Using #request_uri is deprecated. Use fullpath instead."
,
caller
fullpath
end
private
def
named_host?
(
host
)
...
...
@@ -109,4 +102,4 @@ def named_host?(host)
end
end
end
end
\ No newline at end of file
end
actionpack/lib/action_dispatch/middleware/stack.rb
浏览文件 @
9532d746
...
...
@@ -69,11 +69,6 @@ def use(*args, &block)
push
(
middleware
)
end
def
active
ActiveSupport
::
Deprecation
.
warn
"All middlewares in the chain are active since the laziness "
<<
"was removed from the middleware stack"
,
caller
end
def
build
(
app
=
nil
,
&
block
)
app
||=
block
raise
"MiddlewareStack#build requires an app"
unless
app
...
...
actionpack/lib/action_dispatch/testing/test_response.rb
浏览文件 @
9532d746
...
...
@@ -14,99 +14,6 @@ def self.from_response(response)
end
end
module
DeprecatedHelpers
def
template
ActiveSupport
::
Deprecation
.
warn
(
"response.template has been deprecated. Use controller.template instead"
,
caller
)
@template
end
attr_writer
:template
def
session
ActiveSupport
::
Deprecation
.
warn
(
"response.session has been deprecated. Use request.session instead"
,
caller
)
@request
.
session
end
def
assigns
ActiveSupport
::
Deprecation
.
warn
(
"response.assigns has been deprecated. Use controller.assigns instead"
,
caller
)
@template
.
controller
.
assigns
end
def
layout
ActiveSupport
::
Deprecation
.
warn
(
"response.layout has been deprecated. Use template.layout instead"
,
caller
)
@template
.
layout
end
def
redirected_to
::
ActiveSupport
::
Deprecation
.
warn
(
"response.redirected_to is deprecated. Use response.redirect_url instead"
,
caller
)
redirect_url
end
def
redirect_url_match?
(
pattern
)
::
ActiveSupport
::
Deprecation
.
warn
(
"response.redirect_url_match? is deprecated. Use assert_match(/foo/, response.redirect_url) instead"
,
caller
)
return
false
if
redirect_url
.
nil?
p
=
Regexp
.
new
(
pattern
)
if
pattern
.
class
==
String
p
=
pattern
if
pattern
.
class
==
Regexp
return
false
if
p
.
nil?
p
.
match
(
redirect_url
)
!=
nil
end
# Returns the template of the file which was used to
# render this response (or nil)
def
rendered
ActiveSupport
::
Deprecation
.
warn
(
"response.rendered has been deprecated. Use template.rendered instead"
,
caller
)
@template
.
instance_variable_get
(
:@_rendered
)
end
# A shortcut to the flash. Returns an empty hash if no session flash exists.
def
flash
ActiveSupport
::
Deprecation
.
warn
(
"response.flash has been deprecated. Use request.flash instead"
,
caller
)
request
.
session
[
'flash'
]
||
{}
end
# Do we have a flash?
def
has_flash?
ActiveSupport
::
Deprecation
.
warn
(
"response.has_flash? has been deprecated. Use flash.any? instead"
,
caller
)
!
flash
.
empty?
end
# Do we have a flash that has contents?
def
has_flash_with_contents?
ActiveSupport
::
Deprecation
.
warn
(
"response.has_flash_with_contents? has been deprecated. Use flash.any? instead"
,
caller
)
!
flash
.
empty?
end
# Does the specified flash object exist?
def
has_flash_object?
(
name
=
nil
)
ActiveSupport
::
Deprecation
.
warn
(
"response.has_flash_object? has been deprecated. Use flash[name] instead"
,
caller
)
!
flash
[
name
].
nil?
end
# Does the specified object exist in the session?
def
has_session_object?
(
name
=
nil
)
ActiveSupport
::
Deprecation
.
warn
(
"response.has_session_object? has been deprecated. Use session[name] instead"
,
caller
)
!
session
[
name
].
nil?
end
# A shortcut to the template.assigns
def
template_objects
ActiveSupport
::
Deprecation
.
warn
(
"response.template_objects has been deprecated. Use template.assigns instead"
,
caller
)
@template
.
assigns
||
{}
end
# Does the specified template object exist?
def
has_template_object?
(
name
=
nil
)
ActiveSupport
::
Deprecation
.
warn
(
"response.has_template_object? has been deprecated. Use tempate.assigns[name].nil? instead"
,
caller
)
!
template_objects
[
name
].
nil?
end
# Returns binary content (downloadable file), converted to a String
def
binary_content
ActiveSupport
::
Deprecation
.
warn
(
"response.binary_content has been deprecated. Use response.body instead"
,
caller
)
body
end
end
include
DeprecatedHelpers
# Was the response successful?
def
success?
(
200
..
299
).
include?
(
response_code
)
...
...
actionpack/lib/action_view/helpers/atom_feed_helper.rb
浏览文件 @
9532d746
...
...
@@ -51,7 +51,7 @@ module AtomFeedHelper
# * <tt>:language</tt>: Defaults to "en-US".
# * <tt>:root_url</tt>: The HTML alternative that this feed is doubling for. Defaults to / on the current host.
# * <tt>:url</tt>: The URL for this feed. Defaults to the current URL.
# * <tt>:id</tt>: The id for this feed. Defaults to "tag:#{request.host},#{options[:schema_date]}:#{request.
request_uri
.split(".")[0]}"
# * <tt>:id</tt>: The id for this feed. Defaults to "tag:#{request.host},#{options[:schema_date]}:#{request.
fullpath
.split(".")[0]}"
# * <tt>:schema_date</tt>: The date at which the tag scheme for the feed was first used. A good default is the year you
# created the feed. See http://feedvalidator.org/docs/error/InvalidTAG.html for more information. If not specified,
# 2005 is used (as an "I don't care" value).
...
...
actionpack/test/controller/action_pack_assertions_test.rb
浏览文件 @
9532d746
...
...
@@ -315,33 +315,22 @@ def test_template_object_missing
# check the empty flashing
def
test_flash_me_naked
process
:flash_me_naked
assert_deprecated
do
assert
!
@response
.
has_flash?
assert
!
@response
.
has_flash_with_contents?
end
assert
flash
.
empty?
end
# check if we have flash objects
def
test_flash_haves
process
:flash_me
assert_deprecated
do
assert
@response
.
has_flash?
assert
@response
.
has_flash_with_contents?
assert
@response
.
has_flash_object?
(
'hello'
)
end
assert
flash
.
any?
assert_present
flash
[
'hello'
]
end
# ensure we don't have flash objects
def
test_flash_have_nots
process
:nothing
assert_deprecated
do
assert
!
@response
.
has_flash?
assert
!
@response
.
has_flash_with_contents?
assert_nil
@response
.
flash
[
'hello'
]
end
assert
flash
.
empty?
end
# check if we were rendered by a file-based template?
def
test_rendered_action
process
:nothing
...
...
@@ -393,12 +382,8 @@ def test_client_error_response_code
def
test_redirect_url_match
process
:redirect_external
assert
@response
.
redirect?
assert_deprecated
do
assert
@response
.
redirect_url_match?
(
"rubyonrails"
)
assert
@response
.
redirect_url_match?
(
/rubyonrails/
)
assert
!
@response
.
redirect_url_match?
(
"phpoffrails"
)
assert
!
@response
.
redirect_url_match?
(
/perloffrails/
)
end
assert_match
/rubyonrails/
,
@response
.
redirect_url
assert
!
/perloffrails/
.
match
(
@response
.
redirect_url
)
end
# check for a redirection
...
...
actionpack/test/controller/test_test.rb
浏览文件 @
9532d746
...
...
@@ -674,13 +674,6 @@ def test_redirect_url_only_cares_about_location_header
assert_redirected_to
'created resource'
end
end
def
test_binary_content_works_with_send_file
get
:test_send_file
assert_deprecated
do
assert_nothing_raised
(
NoMethodError
)
{
@response
.
binary_content
}
end
end
end
class
InferringClassNameTest
<
ActionController
::
TestCase
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录