adding new tests to cover array and object rendering

This commit is contained in:
João Moura 2015-06-22 03:15:05 -03:00
parent 01a225f0e4
commit d589268f95

View File

@ -47,6 +47,14 @@ module ActionController
render json: @post
end
def render_json_object_without_serializer
render json: {error: 'Result is Invalid'}
end
def render_json_array_object_without_serializer
render json: [{error: 'Result is Invalid'}]
end
def update_and_render_object_with_cache_enabled
@post.updated_at = DateTime.now
@ -160,6 +168,20 @@ module ActionController
assert_equal expected.to_json, @response.body
end
def test_render_json_object_without_serializer
get :render_json_object_without_serializer
assert_equal 'application/json', @response.content_type
assert_equal ({error: 'Result is Invalid'}).to_json, @response.body
end
def test_render_json_array_object_without_serializer
get :render_json_array_object_without_serializer
assert_equal 'application/json', @response.content_type
assert_equal ([{error: 'Result is Invalid'}]).to_json, @response.body
end
def test_render_array_using_implicit_serializer
get :render_array_using_implicit_serializer
assert_equal 'application/json', @response.content_type