Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
87ec72bd
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,体验更适合开发者的 AI 搜索 >>
提交
87ec72bd
编写于
5月 02, 2008
作者:
P
Pratik Naik
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve PartialTemplate tests
上级
b88a6dbc
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
13 addition
and
7 deletion
+13
-7
actionpack/lib/action_view/base.rb
actionpack/lib/action_view/base.rb
+1
-3
actionpack/lib/action_view/partial_template.rb
actionpack/lib/action_view/partial_template.rb
+6
-4
actionpack/test/fixtures/test/_raise.html.erb
actionpack/test/fixtures/test/_raise.html.erb
+1
-0
actionpack/test/template/template_object_test.rb
actionpack/test/template/template_object_test.rb
+5
-0
未找到文件。
actionpack/lib/action_view/base.rb
浏览文件 @
87ec72bd
...
@@ -242,9 +242,7 @@ def render_file(template_path, use_full_path = true, local_assigns = {}) #:nodoc
...
@@ -242,9 +242,7 @@ def render_file(template_path, use_full_path = true, local_assigns = {}) #:nodoc
END_ERROR
END_ERROR
end
end
template
=
Template
.
new
(
self
,
template_path
,
use_full_path
,
local_assigns
)
Template
.
new
(
self
,
template_path
,
use_full_path
,
local_assigns
).
render_template
render_template
(
template
)
end
end
# Renders the template present at <tt>template_path</tt> (relative to the view_paths array).
# Renders the template present at <tt>template_path</tt> (relative to the view_paths array).
...
...
actionpack/lib/action_view/partial_template.rb
浏览文件 @
87ec72bd
...
@@ -24,10 +24,12 @@ def render
...
@@ -24,10 +24,12 @@ def render
def
render_member
(
object
)
def
render_member
(
object
)
@locals
[
@counter_name
]
+=
1
@locals
[
@counter_name
]
+=
1
@locals
[
:object
]
=
@locals
[
@variable_name
]
=
object
@locals
[
:object
]
=
@locals
[
@variable_name
]
=
object
returning
render_template
do
@locals
.
delete
(
@variable_name
)
template
=
render_template
@locals
.
delete
(
:object
)
@locals
.
delete
(
@variable_name
)
end
@locals
.
delete
(
:object
)
template
end
end
def
counter
=
(
num
)
def
counter
=
(
num
)
...
...
actionpack/test/fixtures/test/_raise.html.erb
0 → 100644
浏览文件 @
87ec72bd
<%=
doesnt_exist
%>
\ No newline at end of file
actionpack/test/template/template_object_test.rb
浏览文件 @
87ec72bd
...
@@ -51,6 +51,11 @@ def test_should_create_valid_partial_template
...
@@ -51,6 +51,11 @@ def test_should_create_valid_partial_template
assert
template
.
locals
.
has_key?
(
:partial_only
)
assert
template
.
locals
.
has_key?
(
:partial_only
)
end
end
def
test_partial_with_errors
template
=
ActionView
::
PartialTemplate
.
new
(
@view
,
'test/raise'
,
nil
)
assert_raise
(
ActionView
::
TemplateError
)
{
template
.
render_template
}
end
uses_mocha
'Partial template preparation tests'
do
uses_mocha
'Partial template preparation tests'
do
def
test_should_prepare_on_initialization
def
test_should_prepare_on_initialization
ActionView
::
PartialTemplate
.
any_instance
.
expects
(
:prepare!
)
ActionView
::
PartialTemplate
.
any_instance
.
expects
(
:prepare!
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录