提交 87ec72bd 编写于 作者: P Pratik Naik

Improve PartialTemplate tests

上级 b88a6dbc
......@@ -242,9 +242,7 @@ def render_file(template_path, use_full_path = true, local_assigns = {}) #:nodoc
END_ERROR
end
template = Template.new(self, template_path, use_full_path, local_assigns)
render_template(template)
Template.new(self, template_path, use_full_path, local_assigns).render_template
end
# Renders the template present at <tt>template_path</tt> (relative to the view_paths array).
......
......@@ -24,10 +24,12 @@ def render
def render_member(object)
@locals[@counter_name] += 1
@locals[:object] = @locals[@variable_name] = object
returning render_template do
@locals.delete(@variable_name)
@locals.delete(:object)
end
template = render_template
@locals.delete(@variable_name)
@locals.delete(:object)
template
end
def counter=(num)
......
<%= doesnt_exist %>
\ No newline at end of file
......@@ -51,6 +51,11 @@ def test_should_create_valid_partial_template
assert template.locals.has_key?(:partial_only)
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
def test_should_prepare_on_initialization
ActionView::PartialTemplate.any_instance.expects(:prepare!)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册