@@ -9,20 +9,6 @@ def render_using_implicit_serializer
9
9
render json : @profile
10
10
end
11
11
12
- def render_using_custom_root
13
- with_adapter ActiveModel ::Serializer ::Adapter ::Json do
14
- @profile = Profile . new ( { name : 'Name 1' , description : 'Description 1' , comments : 'Comments 1' } )
15
- render json : @profile , root : "custom_root"
16
- end
17
- end
18
-
19
- def render_using_custom_root_and_meta
20
- with_adapter ActiveModel ::Serializer ::Adapter ::Json do
21
- @profile = Profile . new ( { name : 'Name 1' , description : 'Description 1' , comments : 'Comments 1' } )
22
- render json : @profile , root : "custom_root" , meta : { total : 10 }
23
- end
24
- end
25
-
26
12
def render_using_default_adapter_root
27
13
with_adapter ActiveModel ::Serializer ::Adapter ::JsonApi do
28
14
# JSON-API adapter sets root by default
@@ -31,22 +17,6 @@ def render_using_default_adapter_root
31
17
end
32
18
end
33
19
34
- def render_using_custom_root_in_adapter_with_a_default
35
- # JSON-API adapter sets root by default
36
- @profile = Profile . new ( { name : 'Name 1' , description : 'Description 1' , comments : 'Comments 1' } )
37
- render json : @profile , root : "profile" , adapter : :json_api
38
- end
39
-
40
- def render_array_using_custom_root_and_meta
41
- with_adapter ActiveModel ::Serializer ::Adapter ::Json do
42
- array = [
43
- Profile . new ( { name : 'Name 1' , description : 'Description 1' , comments : 'Comments 1' } ) ,
44
- Profile . new ( { name : 'Name 2' , description : 'Description 2' , comments : 'Comments 2' } )
45
- ]
46
- render json : array , root : "custom_root" , meta : { total : 10 }
47
- end
48
- end
49
-
50
20
def render_array_using_implicit_serializer
51
21
array = [
52
22
Profile . new ( { name : 'Name 1' , description : 'Description 1' , comments : 'Comments 1' } ) ,
@@ -191,24 +161,6 @@ def test_render_using_default_root
191
161
assert_equal expected . to_json , @response . body
192
162
end
193
163
194
- def test_render_using_custom_root_in_adapter_with_a_default
195
- get :render_using_custom_root_in_adapter_with_a_default
196
-
197
- expected = {
198
- data : {
199
- id : assigns ( :profile ) . id . to_s ,
200
- type : "profiles" ,
201
- attributes : {
202
- name : "Name 1" ,
203
- description : "Description 1"
204
- }
205
- }
206
- }
207
-
208
- assert_equal 'application/json' , @response . content_type
209
- assert_equal expected . to_json , @response . body
210
- end
211
-
212
164
def test_render_array_using_implicit_serializer
213
165
get :render_array_using_implicit_serializer
214
166
assert_equal 'application/json' , @response . content_type
0 commit comments