Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Improve PartialTemplate tests

  • Loading branch information...
commit 87ec72bd8c4b5d178ba7a41e605bc9a8e27f9e67 1 parent b88a6db
@lifo lifo authored
View
4 actionpack/lib/action_view/base.rb
@@ -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).
View
10 actionpack/lib/action_view/partial_template.rb
@@ -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)
View
1  actionpack/test/fixtures/test/_raise.html.erb
@@ -0,0 +1 @@
+<%= doesnt_exist %>
View
5 actionpack/test/template/template_object_test.rb
@@ -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!)
Please sign in to comment.
Something went wrong with that request. Please try again.