test/jbuilder_template_test.rb in jbuilder-2.2.3 vs test/jbuilder_template_test.rb in jbuilder-2.2.4
- old
+ new
@@ -116,13 +116,23 @@
JBUILDER
assert_collection_rendered json
end
+ test 'partial! renders collections when as argument is a string' do
+ json = render_jbuilder <<-JBUILDER
+ json.partial! 'blog_post', collection: BLOG_POST_COLLECTION, as: "blog_post"
+ JBUILDER
+
+ assert_collection_rendered json
+ end
+
test 'partial! renders collections as collections' do
json = render_jbuilder <<-JBUILDER
json.partial! 'collection', collection: COLLECTION_COLLECTION, as: :collection
JBUILDER
+
+ assert_equal 5, MultiJson.load(json).length
end
test 'partial! renders as empty array for nil-collection' do
json = render_jbuilder <<-JBUILDER
json.partial! 'blog_post', :collection => nil, :as => :blog_post