use :root option in render :json

ArraySerializer can now render arrays with no root
This commit is contained in:
Tee Parham
2012-05-18 12:45:43 -06:00
parent 5beecd5947
commit dd00e218b1
2 changed files with 11 additions and 1 deletions

View File

@@ -140,6 +140,11 @@ class RenderJsonTest < ActionController::TestCase
render :json => HypermediaSerializable.new
end
def render_json_array_with_no_root
render :json => [], :root => false
end
private
def default_serializer_options
if params[:check_defaults]
@@ -250,4 +255,9 @@ class RenderJsonTest < ActionController::TestCase
get :render_json_with_links
assert_match '{"link":"http://www.nextangle.com/hypermedia"}', @response.body
end
def test_render_json_array_with_no_root
get :render_json_array_with_no_root
assert_equal '[]', @response.body
end
end