File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,14 @@ def render_object_with_cache_enabled
47
47
render json : @post
48
48
end
49
49
50
+ def render_json_object_without_serializer
51
+ render json : { error : 'Result is Invalid' }
52
+ end
53
+
54
+ def render_json_array_object_without_serializer
55
+ render json : [ { error : 'Result is Invalid' } ]
56
+ end
57
+
50
58
def update_and_render_object_with_cache_enabled
51
59
@post . updated_at = DateTime . now
52
60
@@ -160,6 +168,20 @@ def test_render_using_default_root
160
168
assert_equal expected . to_json , @response . body
161
169
end
162
170
171
+ def test_render_json_object_without_serializer
172
+ get :render_json_object_without_serializer
173
+
174
+ assert_equal 'application/json' , @response . content_type
175
+ assert_equal ( { error : 'Result is Invalid' } ) . to_json , @response . body
176
+ end
177
+
178
+ def test_render_json_array_object_without_serializer
179
+ get :render_json_array_object_without_serializer
180
+
181
+ assert_equal 'application/json' , @response . content_type
182
+ assert_equal ( [ { error : 'Result is Invalid' } ] ) . to_json , @response . body
183
+ end
184
+
163
185
def test_render_array_using_implicit_serializer
164
186
get :render_array_using_implicit_serializer
165
187
assert_equal 'application/json' , @response . content_type
You can’t perform that action at this time.
0 commit comments