Skip to content

Commit

Permalink
A test for partial! + locals without :locals key
Browse files Browse the repository at this point in the history
  • Loading branch information
amatsuda committed Feb 23, 2015
1 parent 8861e48 commit 5080d61
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/jbuilder_template_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5080d61

Please sign in to comment.