From 5080d61a60f59b061b4e05d391a46b58a4c1c34c Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Tue, 17 Feb 2015 22:16:32 +0900 Subject: [PATCH] A test for partial! + locals without :locals key --- test/jbuilder_template_test.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/jbuilder_template_test.rb b/test/jbuilder_template_test.rb index 14e11b8..55a8c4d 100644 --- a/test/jbuilder_template_test.rb +++ b/test/jbuilder_template_test.rb @@ -40,7 +40,7 @@ class JbuilderTemplateTest < ActionView::TestCase def partials { - '_partial.json.jbuilder' => 'json.content "hello"', + '_partial.json.jbuilder' => 'foo ||= "hello"; json.content foo', '_blog_post.json.jbuilder' => BLOG_POST_PARTIAL, '_collection.json.jbuilder' => COLLECTION_PARTIAL } @@ -110,6 +110,14 @@ def assert_collection_rendered(json, context = nil) assert_equal 'hello', MultiJson.load(json)['content'] end + test 'partial! + locals without :locals key' do + json = render_jbuilder <<-JBUILDER + json.partial! 'partial', foo: 'goodbye' + JBUILDER + + assert_equal 'goodbye', MultiJson.load(json)['content'] + end + test 'partial! renders collections' do json = render_jbuilder <<-JBUILDER json.partial! 'blog_post', :collection => BLOG_POST_COLLECTION, :as => :blog_post