Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
03960048
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,发现更多精彩内容 >>
提交
03960048
编写于
10月 21, 2009
作者:
J
José Valim
提交者:
Yehuda Katz
11月 01, 2009
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add some basic render_test to AbstractController.
上级
0cf16ddb
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
98 addition
and
13 deletion
+98
-13
actionmailer/lib/action_mailer/base.rb
actionmailer/lib/action_mailer/base.rb
+0
-5
actionpack/lib/abstract_controller/layouts.rb
actionpack/lib/abstract_controller/layouts.rb
+1
-1
actionpack/lib/abstract_controller/rendering_controller.rb
actionpack/lib/abstract_controller/rendering_controller.rb
+0
-7
actionpack/lib/action_controller/metal/rendering_controller.rb
...npack/lib/action_controller/metal/rendering_controller.rb
+9
-0
actionpack/test/abstract/render_test.rb
actionpack/test/abstract/render_test.rb
+88
-0
未找到文件。
actionmailer/lib/action_mailer/base.rb
浏览文件 @
03960048
...
...
@@ -386,11 +386,6 @@ def formats
[
:"*/*"
]
end
# Refactor out all mailer_name
def
_prefix
mailer_name
end
class
<<
self
attr_writer
:mailer_name
...
...
actionpack/lib/abstract_controller/layouts.rb
浏览文件 @
03960048
...
...
@@ -195,7 +195,7 @@ def _layout_for_option(name, details)
def
_determine_template
(
options
)
super
return
if
(
options
.
key?
(
:text
)
||
options
.
key?
(
:inline
)
||
options
.
key?
(
:partial
))
&&
!
options
.
key?
(
:layout
)
return
unless
(
options
.
keys
&
[
:text
,
:inline
,
:partial
]).
empty?
||
options
.
key?
(
:layout
)
layout
=
options
.
key?
(
:layout
)
?
options
[
:layout
]
:
:default
options
[
:_layout
]
=
_layout_for_option
(
layout
,
options
[
:_template
].
details
)
end
...
...
actionpack/lib/abstract_controller/rendering_controller.rb
浏览文件 @
03960048
...
...
@@ -118,9 +118,6 @@ def _determine_template(options)
options
[
:_template_name
]
=
options
[
:template
]
elsif
options
.
key?
(
:file
)
options
[
:_template_name
]
=
options
[
:file
]
elsif
!
options
.
key?
(
:partial
)
options
[
:_template_name
]
||=
options
[
:action
]
options
[
:_prefix
]
=
_prefix
end
name
=
(
options
[
:_template_name
]
||
action_name
).
to_s
...
...
@@ -138,10 +135,6 @@ def template_exists?(name, details, options)
view_paths
.
exists?
(
name
,
details
,
options
[
:_prefix
],
options
[
:_partial
])
end
def
_prefix
self
.
class
.
name
.
underscore
end
def
with_template_cache
(
name
)
yield
end
...
...
actionpack/lib/action_controller/metal/rendering_controller.rb
浏览文件 @
03960048
...
...
@@ -65,6 +65,15 @@ def _prefix
controller_path
end
def
_determine_template
(
options
)
if
(
options
.
keys
&
[
:partial
,
:file
,
:template
,
:text
,
:inline
]).
empty?
options
[
:_template_name
]
||=
options
[
:action
]
options
[
:_prefix
]
=
_prefix
end
super
end
def
format_for_text
formats
.
first
end
...
...
actionpack/test/abstract/render_test.rb
0 → 100644
浏览文件 @
03960048
require
'abstract_unit'
module
AbstractController
module
Testing
class
ControllerRenderer
<
AbstractController
::
Base
include
AbstractController
::
RenderingController
self
.
view_paths
=
[
ActionView
::
FixtureResolver
.
new
(
"default.erb"
=>
"With Default"
,
"template.erb"
=>
"With Template"
,
"some/file.erb"
=>
"With File"
,
"template_name.erb"
=>
"With Template Name"
)]
def
template
render
:template
=>
"template"
end
def
file
render
:file
=>
"some/file"
end
def
inline
render
:inline
=>
"With <%= :Inline %>"
end
def
text
render
:text
=>
"With Text"
end
def
default
render
end
def
template_name
render
:_template_name
=>
:template_name
end
def
object
render
:_template
=>
ActionView
::
TextTemplate
.
new
(
"With Object"
)
end
end
class
TestRenderer
<
ActiveSupport
::
TestCase
def
setup
@controller
=
ControllerRenderer
.
new
end
def
test_render_template
@controller
.
process
(
:template
)
assert_equal
"With Template"
,
@controller
.
response_body
end
def
test_render_file
@controller
.
process
(
:file
)
assert_equal
"With File"
,
@controller
.
response_body
end
def
test_render_inline
@controller
.
process
(
:inline
)
assert_equal
"With Inline"
,
@controller
.
response_body
end
def
test_render_text
@controller
.
process
(
:text
)
assert_equal
"With Text"
,
@controller
.
response_body
end
def
test_render_default
@controller
.
process
(
:default
)
assert_equal
"With Default"
,
@controller
.
response_body
end
def
test_render_template_name
@controller
.
process
(
:template_name
)
assert_equal
"With Template Name"
,
@controller
.
response_body
end
def
test_render_object
@controller
.
process
(
:object
)
assert_equal
"With Object"
,
@controller
.
response_body
end
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录