active_model_serializers 0.10.0 → 0.10.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -4
  3. data/.travis.yml +9 -1
  4. data/CHANGELOG.md +81 -2
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +5 -2
  7. data/README.md +24 -24
  8. data/Rakefile +3 -3
  9. data/active_model_serializers.gemspec +20 -24
  10. data/docs/ARCHITECTURE.md +6 -7
  11. data/docs/README.md +2 -0
  12. data/docs/general/adapters.md +4 -2
  13. data/docs/general/caching.md +7 -1
  14. data/docs/general/configuration_options.md +70 -1
  15. data/docs/general/deserialization.md +1 -1
  16. data/docs/general/fields.md +31 -0
  17. data/docs/general/rendering.md +42 -3
  18. data/docs/general/serializers.md +97 -8
  19. data/docs/howto/add_pagination_links.md +4 -5
  20. data/docs/howto/add_relationship_links.md +137 -0
  21. data/docs/howto/add_root_key.md +4 -0
  22. data/docs/howto/grape_integration.md +42 -0
  23. data/docs/howto/outside_controller_use.md +9 -2
  24. data/docs/howto/passing_arbitrary_options.md +2 -2
  25. data/docs/howto/test.md +2 -0
  26. data/docs/howto/upgrade_from_0_8_to_0_10.md +265 -0
  27. data/docs/integrations/ember-and-json-api.md +64 -32
  28. data/docs/jsonapi/schema.md +1 -1
  29. data/lib/action_controller/serialization.rb +13 -3
  30. data/lib/active_model/serializer/adapter/base.rb +2 -0
  31. data/lib/active_model/serializer/array_serializer.rb +8 -5
  32. data/lib/active_model/serializer/association.rb +19 -4
  33. data/lib/active_model/serializer/belongs_to_reflection.rb +0 -3
  34. data/lib/active_model/serializer/collection_serializer.rb +35 -12
  35. data/lib/active_model/serializer/{associations.rb → concerns/associations.rb} +13 -11
  36. data/lib/active_model/serializer/{attributes.rb → concerns/attributes.rb} +0 -0
  37. data/lib/active_model/serializer/{caching.rb → concerns/caching.rb} +72 -113
  38. data/lib/active_model/serializer/{configuration.rb → concerns/configuration.rb} +25 -1
  39. data/lib/active_model/serializer/{links.rb → concerns/links.rb} +0 -0
  40. data/lib/active_model/serializer/{meta.rb → concerns/meta.rb} +0 -0
  41. data/lib/active_model/serializer/{type.rb → concerns/type.rb} +0 -0
  42. data/lib/active_model/serializer/error_serializer.rb +11 -7
  43. data/lib/active_model/serializer/errors_serializer.rb +25 -20
  44. data/lib/active_model/serializer/has_many_reflection.rb +0 -3
  45. data/lib/active_model/serializer/has_one_reflection.rb +0 -3
  46. data/lib/active_model/serializer/lint.rb +134 -130
  47. data/lib/active_model/serializer/reflection.rb +37 -21
  48. data/lib/active_model/serializer/version.rb +1 -1
  49. data/lib/active_model/serializer.rb +76 -37
  50. data/lib/active_model_serializers/adapter/attributes.rb +3 -66
  51. data/lib/active_model_serializers/adapter/base.rb +38 -38
  52. data/lib/active_model_serializers/adapter/json_api/link.rb +1 -1
  53. data/lib/active_model_serializers/adapter/json_api/pagination_links.rb +8 -1
  54. data/lib/active_model_serializers/adapter/json_api/relationship.rb +30 -19
  55. data/lib/active_model_serializers/adapter/json_api/resource_identifier.rb +23 -9
  56. data/lib/active_model_serializers/adapter/json_api.rb +44 -43
  57. data/lib/active_model_serializers/adapter.rb +6 -0
  58. data/lib/active_model_serializers/deprecate.rb +1 -2
  59. data/lib/active_model_serializers/deserialization.rb +2 -0
  60. data/lib/active_model_serializers/key_transform.rb +4 -0
  61. data/lib/active_model_serializers/lookup_chain.rb +80 -0
  62. data/lib/active_model_serializers/model.rb +4 -2
  63. data/lib/active_model_serializers/railtie.rb +3 -1
  64. data/lib/active_model_serializers/register_jsonapi_renderer.rb +44 -31
  65. data/lib/active_model_serializers/serializable_resource.rb +6 -5
  66. data/lib/active_model_serializers/serialization_context.rb +10 -3
  67. data/lib/active_model_serializers.rb +7 -0
  68. data/lib/generators/rails/serializer_generator.rb +4 -4
  69. data/lib/grape/active_model_serializers.rb +7 -5
  70. data/lib/grape/formatters/active_model_serializers.rb +19 -2
  71. data/lib/grape/helpers/active_model_serializers.rb +1 -0
  72. data/test/action_controller/adapter_selector_test.rb +4 -4
  73. data/test/action_controller/explicit_serializer_test.rb +5 -4
  74. data/test/action_controller/json/include_test.rb +106 -27
  75. data/test/action_controller/json_api/errors_test.rb +6 -7
  76. data/test/action_controller/json_api/fields_test.rb +57 -0
  77. data/test/action_controller/json_api/linked_test.rb +29 -24
  78. data/test/action_controller/json_api/pagination_test.rb +19 -19
  79. data/test/action_controller/json_api/transform_test.rb +3 -3
  80. data/test/action_controller/lookup_proc_test.rb +49 -0
  81. data/test/action_controller/namespace_lookup_test.rb +226 -0
  82. data/test/action_controller/serialization_test.rb +10 -7
  83. data/test/active_model_serializers/json_pointer_test.rb +15 -13
  84. data/test/active_model_serializers/key_transform_test.rb +286 -252
  85. data/test/active_model_serializers/model_test.rb +17 -4
  86. data/test/active_model_serializers/register_jsonapi_renderer_test_isolated.rb +143 -0
  87. data/test/active_model_serializers/serialization_context_test_isolated.rb +23 -10
  88. data/test/adapter/attributes_test.rb +43 -0
  89. data/test/adapter/json/collection_test.rb +14 -0
  90. data/test/adapter/json/transform_test.rb +15 -15
  91. data/test/adapter/json_api/collection_test.rb +4 -3
  92. data/test/adapter/json_api/errors_test.rb +17 -19
  93. data/test/adapter/json_api/fields_test.rb +4 -3
  94. data/test/adapter/json_api/has_many_test.rb +39 -18
  95. data/test/adapter/json_api/include_data_if_sideloaded_test.rb +166 -0
  96. data/test/adapter/json_api/json_api_test.rb +5 -7
  97. data/test/adapter/json_api/linked_test.rb +33 -12
  98. data/test/adapter/json_api/links_test.rb +4 -2
  99. data/test/adapter/json_api/pagination_links_test.rb +35 -8
  100. data/test/adapter/json_api/relationship_test.rb +309 -73
  101. data/test/adapter/json_api/resource_identifier_test.rb +27 -2
  102. data/test/adapter/json_api/resource_meta_test.rb +3 -3
  103. data/test/adapter/json_api/transform_test.rb +255 -253
  104. data/test/adapter/json_api/type_test.rb +1 -1
  105. data/test/adapter/json_test.rb +8 -7
  106. data/test/adapter/null_test.rb +1 -2
  107. data/test/adapter/polymorphic_test.rb +5 -5
  108. data/test/adapter_test.rb +1 -1
  109. data/test/benchmark/app.rb +1 -1
  110. data/test/benchmark/benchmarking_support.rb +1 -1
  111. data/test/benchmark/bm_active_record.rb +81 -0
  112. data/test/benchmark/bm_adapter.rb +38 -0
  113. data/test/benchmark/bm_caching.rb +16 -16
  114. data/test/benchmark/bm_lookup_chain.rb +83 -0
  115. data/test/benchmark/bm_transform.rb +16 -5
  116. data/test/benchmark/controllers.rb +16 -17
  117. data/test/benchmark/fixtures.rb +72 -72
  118. data/test/cache_test.rb +143 -49
  119. data/test/collection_serializer_test.rb +3 -3
  120. data/test/fixtures/poro.rb +52 -48
  121. data/test/generators/serializer_generator_test.rb +22 -5
  122. data/test/grape_test.rb +152 -56
  123. data/test/lint_test.rb +1 -1
  124. data/test/logger_test.rb +13 -11
  125. data/test/serializable_resource_test.rb +18 -22
  126. data/test/serializers/association_macros_test.rb +3 -2
  127. data/test/serializers/associations_test.rb +107 -32
  128. data/test/serializers/attribute_test.rb +2 -2
  129. data/test/serializers/attributes_test.rb +1 -1
  130. data/test/serializers/fieldset_test.rb +1 -1
  131. data/test/serializers/meta_test.rb +12 -6
  132. data/test/serializers/root_test.rb +1 -1
  133. data/test/serializers/serializer_for_test.rb +6 -4
  134. data/test/serializers/serializer_for_with_namespace_test.rb +87 -0
  135. data/test/support/isolated_unit.rb +5 -2
  136. data/test/support/rails5_shims.rb +8 -2
  137. data/test/support/rails_app.rb +0 -9
  138. data/test/support/serialization_testing.rb +23 -5
  139. data/test/test_helper.rb +1 -0
  140. metadata +85 -34
  141. data/.rubocop_todo.yml +0 -167
  142. data/lib/active_model/serializer/include_tree.rb +0 -111
  143. data/test/adapter/json_api/relationships_test.rb +0 -199
  144. data/test/include_tree/from_include_args_test.rb +0 -26
  145. data/test/include_tree/from_string_test.rb +0 -94
  146. data/test/include_tree/include_args_to_hash_test.rb +0 -64
@@ -1,263 +1,297 @@
1
1
  require 'test_helper'
2
2
 
3
- class ActiveModelSerializers::KeyTransformTest < ActiveSupport::TestCase
4
- def test_camel
5
- obj = Object.new
6
- scenarios = [
7
- {
8
- value: { :"some-key" => 'value' },
9
- expected: { :SomeKey => 'value' }
10
- },
11
- {
12
- value: { :someKey => 'value' },
13
- expected: { :SomeKey => 'value' }
14
- },
15
- {
16
- value: { :some_key => 'value' },
17
- expected: { :SomeKey => 'value' }
18
- },
19
- {
20
- value: { 'some-key' => 'value' },
21
- expected: { 'SomeKey' => 'value' }
22
- },
23
- {
24
- value: { 'someKey' => 'value' },
25
- expected: { 'SomeKey' => 'value' }
26
- },
27
- {
28
- value: { 'some_key' => 'value' },
29
- expected: { 'SomeKey' => 'value' }
30
- },
31
- {
32
- value: :"some-value",
33
- expected: :SomeValue
34
- },
35
- {
36
- value: :some_value,
37
- expected: :SomeValue
38
- },
39
- {
40
- value: :someValue,
41
- expected: :SomeValue
42
- },
43
- {
44
- value: 'some-value',
45
- expected: 'SomeValue'
46
- },
47
- {
48
- value: 'someValue',
49
- expected: 'SomeValue'
50
- },
51
- {
52
- value: 'some_value',
53
- expected: 'SomeValue'
54
- },
55
- {
56
- value: obj,
57
- expected: obj
58
- },
59
- {
60
- value: nil,
61
- expected: nil
62
- }
63
- ]
64
- scenarios.each do |s|
65
- result = ActiveModelSerializers::KeyTransform.camel(s[:value])
66
- assert_equal s[:expected], result
3
+ module ActiveModelSerializers
4
+ class KeyTransformTest < ActiveSupport::TestCase
5
+ def test_camel
6
+ obj = Object.new
7
+ scenarios = [
8
+ {
9
+ value: { :"some-key" => 'value' },
10
+ expected: { SomeKey: 'value' }
11
+ },
12
+ {
13
+ value: { someKey: 'value' },
14
+ expected: { SomeKey: 'value' }
15
+ },
16
+ {
17
+ value: { some_key: 'value' },
18
+ expected: { SomeKey: 'value' }
19
+ },
20
+ {
21
+ value: { 'some-key' => 'value' },
22
+ expected: { 'SomeKey' => 'value' }
23
+ },
24
+ {
25
+ value: { 'someKey' => 'value' },
26
+ expected: { 'SomeKey' => 'value' }
27
+ },
28
+ {
29
+ value: { 'some_key' => 'value' },
30
+ expected: { 'SomeKey' => 'value' }
31
+ },
32
+ {
33
+ value: :"some-value",
34
+ expected: :SomeValue
35
+ },
36
+ {
37
+ value: :some_value,
38
+ expected: :SomeValue
39
+ },
40
+ {
41
+ value: :someValue,
42
+ expected: :SomeValue
43
+ },
44
+ {
45
+ value: 'some-value',
46
+ expected: 'SomeValue'
47
+ },
48
+ {
49
+ value: 'someValue',
50
+ expected: 'SomeValue'
51
+ },
52
+ {
53
+ value: 'some_value',
54
+ expected: 'SomeValue'
55
+ },
56
+ {
57
+ value: obj,
58
+ expected: obj
59
+ },
60
+ {
61
+ value: nil,
62
+ expected: nil
63
+ },
64
+ {
65
+ value: [
66
+ { some_value: 'value' }
67
+ ],
68
+ expected: [
69
+ { SomeValue: 'value' }
70
+ ]
71
+ }
72
+ ]
73
+ scenarios.each do |s|
74
+ result = ActiveModelSerializers::KeyTransform.camel(s[:value])
75
+ assert_equal s[:expected], result
76
+ end
67
77
  end
68
- end
69
78
 
70
- def test_camel_lower
71
- obj = Object.new
72
- scenarios = [
73
- {
74
- value: { :"some-key" => 'value' },
75
- expected: { :someKey => 'value' }
76
- },
77
- {
78
- value: { :SomeKey => 'value' },
79
- expected: { :someKey => 'value' }
80
- },
81
- {
82
- value: { :some_key => 'value' },
83
- expected: { :someKey => 'value' }
84
- },
85
- {
86
- value: { 'some-key' => 'value' },
87
- expected: { 'someKey' => 'value' }
88
- },
89
- {
90
- value: { 'SomeKey' => 'value' },
91
- expected: { 'someKey' => 'value' }
92
- },
93
- {
94
- value: { 'some_key' => 'value' },
95
- expected: { 'someKey' => 'value' }
96
- },
97
- {
98
- value: :"some-value",
99
- expected: :someValue
100
- },
101
- {
102
- value: :SomeValue,
103
- expected: :someValue
104
- },
105
- {
106
- value: :some_value,
107
- expected: :someValue
108
- },
109
- {
110
- value: 'some-value',
111
- expected: 'someValue'
112
- },
113
- {
114
- value: 'SomeValue',
115
- expected: 'someValue'
116
- },
117
- {
118
- value: 'some_value',
119
- expected: 'someValue'
120
- },
121
- {
122
- value: obj,
123
- expected: obj
124
- },
125
- {
126
- value: nil,
127
- expected: nil
128
- }
129
- ]
130
- scenarios.each do |s|
131
- result = ActiveModelSerializers::KeyTransform.camel_lower(s[:value])
132
- assert_equal s[:expected], result
79
+ def test_camel_lower
80
+ obj = Object.new
81
+ scenarios = [
82
+ {
83
+ value: { :"some-key" => 'value' },
84
+ expected: { someKey: 'value' }
85
+ },
86
+ {
87
+ value: { SomeKey: 'value' },
88
+ expected: { someKey: 'value' }
89
+ },
90
+ {
91
+ value: { some_key: 'value' },
92
+ expected: { someKey: 'value' }
93
+ },
94
+ {
95
+ value: { 'some-key' => 'value' },
96
+ expected: { 'someKey' => 'value' }
97
+ },
98
+ {
99
+ value: { 'SomeKey' => 'value' },
100
+ expected: { 'someKey' => 'value' }
101
+ },
102
+ {
103
+ value: { 'some_key' => 'value' },
104
+ expected: { 'someKey' => 'value' }
105
+ },
106
+ {
107
+ value: :"some-value",
108
+ expected: :someValue
109
+ },
110
+ {
111
+ value: :SomeValue,
112
+ expected: :someValue
113
+ },
114
+ {
115
+ value: :some_value,
116
+ expected: :someValue
117
+ },
118
+ {
119
+ value: 'some-value',
120
+ expected: 'someValue'
121
+ },
122
+ {
123
+ value: 'SomeValue',
124
+ expected: 'someValue'
125
+ },
126
+ {
127
+ value: 'some_value',
128
+ expected: 'someValue'
129
+ },
130
+ {
131
+ value: obj,
132
+ expected: obj
133
+ },
134
+ {
135
+ value: nil,
136
+ expected: nil
137
+ },
138
+ {
139
+ value: [
140
+ { some_value: 'value' }
141
+ ],
142
+ expected: [
143
+ { someValue: 'value' }
144
+ ]
145
+ }
146
+ ]
147
+ scenarios.each do |s|
148
+ result = ActiveModelSerializers::KeyTransform.camel_lower(s[:value])
149
+ assert_equal s[:expected], result
150
+ end
133
151
  end
134
- end
135
152
 
136
- def test_dash
137
- obj = Object.new
138
- scenarios = [
139
- {
140
- value: { :some_key => 'value' },
141
- expected: { :"some-key" => 'value' }
142
- },
143
- {
144
- value: { 'some_key' => 'value' },
145
- expected: { 'some-key' => 'value' }
146
- },
147
- {
148
- value: { :SomeKey => 'value' },
149
- expected: { :"some-key" => 'value' }
150
- },
151
- {
152
- value: { 'SomeKey' => 'value' },
153
- expected: { 'some-key' => 'value' }
154
- },
155
- {
156
- value: { :someKey => 'value' },
157
- expected: { :"some-key" => 'value' }
158
- },
159
- {
160
- value: { 'someKey' => 'value' },
161
- expected: { 'some-key' => 'value' }
162
- },
163
- {
164
- value: :some_value,
165
- expected: :"some-value"
166
- },
167
- {
168
- value: :SomeValue,
169
- expected: :"some-value"
170
- },
171
- {
172
- value: 'SomeValue',
173
- expected: 'some-value'
174
- },
175
- {
176
- value: :someValue,
177
- expected: :"some-value"
178
- },
179
- {
180
- value: 'someValue',
181
- expected: 'some-value'
182
- },
183
- {
184
- value: obj,
185
- expected: obj
186
- },
187
- {
188
- value: nil,
189
- expected: nil
190
- }
191
- ]
192
- scenarios.each do |s|
193
- result = ActiveModelSerializers::KeyTransform.dash(s[:value])
194
- assert_equal s[:expected], result
153
+ def test_dash
154
+ obj = Object.new
155
+ scenarios = [
156
+ {
157
+ value: { some_key: 'value' },
158
+ expected: { :"some-key" => 'value' }
159
+ },
160
+ {
161
+ value: { 'some_key' => 'value' },
162
+ expected: { 'some-key' => 'value' }
163
+ },
164
+ {
165
+ value: { SomeKey: 'value' },
166
+ expected: { :"some-key" => 'value' }
167
+ },
168
+ {
169
+ value: { 'SomeKey' => 'value' },
170
+ expected: { 'some-key' => 'value' }
171
+ },
172
+ {
173
+ value: { someKey: 'value' },
174
+ expected: { :"some-key" => 'value' }
175
+ },
176
+ {
177
+ value: { 'someKey' => 'value' },
178
+ expected: { 'some-key' => 'value' }
179
+ },
180
+ {
181
+ value: :some_value,
182
+ expected: :"some-value"
183
+ },
184
+ {
185
+ value: :SomeValue,
186
+ expected: :"some-value"
187
+ },
188
+ {
189
+ value: 'SomeValue',
190
+ expected: 'some-value'
191
+ },
192
+ {
193
+ value: :someValue,
194
+ expected: :"some-value"
195
+ },
196
+ {
197
+ value: 'someValue',
198
+ expected: 'some-value'
199
+ },
200
+ {
201
+ value: obj,
202
+ expected: obj
203
+ },
204
+ {
205
+ value: nil,
206
+ expected: nil
207
+ },
208
+ {
209
+ value: [
210
+ { 'some_value' => 'value' }
211
+ ],
212
+ expected: [
213
+ { 'some-value' => 'value' }
214
+ ]
215
+ }
216
+ ]
217
+ scenarios.each do |s|
218
+ result = ActiveModelSerializers::KeyTransform.dash(s[:value])
219
+ assert_equal s[:expected], result
220
+ end
195
221
  end
196
- end
197
222
 
198
- def test_underscore
199
- obj = Object.new
200
- scenarios = [
201
- {
202
- value: { :"some-key" => 'value' },
203
- expected: { :some_key => 'value' }
204
- },
205
- {
206
- value: { 'some-key' => 'value' },
207
- expected: { 'some_key' => 'value' }
208
- },
209
- {
210
- value: { :SomeKey => 'value' },
211
- expected: { :some_key => 'value' }
212
- },
213
- {
214
- value: { 'SomeKey' => 'value' },
215
- expected: { 'some_key' => 'value' }
216
- },
217
- {
218
- value: { :someKey => 'value' },
219
- expected: { :some_key => 'value' }
220
- },
221
- {
222
- value: { 'someKey' => 'value' },
223
- expected: { 'some_key' => 'value' }
224
- },
225
- {
226
- value: :"some-value",
227
- expected: :some_value
228
- },
229
- {
230
- value: :SomeValue,
231
- expected: :some_value
232
- },
233
- {
234
- value: :someValue,
235
- expected: :some_value
236
- },
237
- {
238
- value: 'some-value',
239
- expected: 'some_value'
240
- },
241
- {
242
- value: 'SomeValue',
243
- expected: 'some_value'
244
- },
245
- {
246
- value: 'someValue',
247
- expected: 'some_value'
248
- },
249
- {
250
- value: obj,
251
- expected: obj
252
- },
253
- {
254
- value: nil,
255
- expected: nil
256
- }
257
- ]
258
- scenarios.each do |s|
259
- result = ActiveModelSerializers::KeyTransform.underscore(s[:value])
260
- assert_equal s[:expected], result
223
+ def test_underscore
224
+ obj = Object.new
225
+ scenarios = [
226
+ {
227
+ value: { :"some-key" => 'value' },
228
+ expected: { some_key: 'value' }
229
+ },
230
+ {
231
+ value: { 'some-key' => 'value' },
232
+ expected: { 'some_key' => 'value' }
233
+ },
234
+ {
235
+ value: { SomeKey: 'value' },
236
+ expected: { some_key: 'value' }
237
+ },
238
+ {
239
+ value: { 'SomeKey' => 'value' },
240
+ expected: { 'some_key' => 'value' }
241
+ },
242
+ {
243
+ value: { someKey: 'value' },
244
+ expected: { some_key: 'value' }
245
+ },
246
+ {
247
+ value: { 'someKey' => 'value' },
248
+ expected: { 'some_key' => 'value' }
249
+ },
250
+ {
251
+ value: :"some-value",
252
+ expected: :some_value
253
+ },
254
+ {
255
+ value: :SomeValue,
256
+ expected: :some_value
257
+ },
258
+ {
259
+ value: :someValue,
260
+ expected: :some_value
261
+ },
262
+ {
263
+ value: 'some-value',
264
+ expected: 'some_value'
265
+ },
266
+ {
267
+ value: 'SomeValue',
268
+ expected: 'some_value'
269
+ },
270
+ {
271
+ value: 'someValue',
272
+ expected: 'some_value'
273
+ },
274
+ {
275
+ value: obj,
276
+ expected: obj
277
+ },
278
+ {
279
+ value: nil,
280
+ expected: nil
281
+ },
282
+ {
283
+ value: [
284
+ { 'some-value' => 'value' }
285
+ ],
286
+ expected: [
287
+ { 'some_value' => 'value' }
288
+ ]
289
+ }
290
+ ]
291
+ scenarios.each do |s|
292
+ result = ActiveModelSerializers::KeyTransform.underscore(s[:value])
293
+ assert_equal s[:expected], result
294
+ end
261
295
  end
262
296
  end
263
297
  end
@@ -1,9 +1,22 @@
1
1
  require 'test_helper'
2
2
 
3
- class ActiveModelSerializers::ModelTest < ActiveSupport::TestCase
4
- include ActiveModel::Serializer::Lint::Tests
3
+ module ActiveModelSerializers
4
+ class ModelTest < ActiveSupport::TestCase
5
+ include ActiveModel::Serializer::Lint::Tests
5
6
 
6
- def setup
7
- @resource = ActiveModelSerializers::Model.new
7
+ def setup
8
+ @resource = ActiveModelSerializers::Model.new
9
+ end
10
+
11
+ def test_initialization_with_string_keys
12
+ klass = Class.new(ActiveModelSerializers::Model) do
13
+ attr_accessor :key
14
+ end
15
+ value = 'value'
16
+
17
+ model_instance = klass.new('key' => value)
18
+
19
+ assert_equal model_instance.read_attribute_for_serialization(:key), value
20
+ end
8
21
  end
9
22
  end