File tree Expand file tree Collapse file tree 3 files changed +22
-16
lines changed
unit/active_model/serializer Expand file tree Collapse file tree 3 files changed +22
-16
lines changed Original file line number Diff line number Diff line change @@ -142,3 +142,25 @@ module TestNamespace
142
142
class ProfileSerializer < ::ProfileSerializer ; end
143
143
class UserSerializer < ::UserSerializer ; end
144
144
end
145
+
146
+ ActiveModel ::Serializer . setup do |config |
147
+ config . default_key_type = :name
148
+ end
149
+
150
+ class NameKeyUserSerializer < ActiveModel ::Serializer
151
+ attributes :name , :email
152
+
153
+ has_one :profile
154
+ end
155
+
156
+ class NameKeyPostSerializer < ActiveModel ::Serializer
157
+ attributes :title , :body
158
+
159
+ has_many :comments
160
+ end
161
+
162
+ ActiveModel ::Serializer . setup do |config |
163
+ config . default_key_type = nil
164
+ end
165
+
166
+
Original file line number Diff line number Diff line change @@ -243,14 +243,6 @@ def test_associations_embedding_objects_using_embed_namespace
243
243
} , @post_serializer . as_json )
244
244
end
245
245
246
- CONFIG . default_key_type = :name
247
- class NameKeyPostSerializer < ActiveModel ::Serializer
248
- attributes :title , :body
249
-
250
- has_many :comments
251
- end
252
- CONFIG . default_key_type = nil
253
-
254
246
def test_associations_name_key_embedding_ids_serialization_using_serializable_hash
255
247
@association = NameKeyPostSerializer . _associations [ :comments ]
256
248
@association . embed = :ids
Original file line number Diff line number Diff line change @@ -217,14 +217,6 @@ def test_associations_embedding_ids_using_embed_namespace_and_embed_in_root_key
217
217
} , @user_serializer . as_json )
218
218
end
219
219
220
- CONFIG . default_key_type = :name
221
- class NameKeyUserSerializer < ActiveModel ::Serializer
222
- attributes :name , :email
223
-
224
- has_one :profile
225
- end
226
- CONFIG . default_key_type = nil
227
-
228
220
def test_associations_name_key_embedding_ids_serialization_using_serializable_hash
229
221
@association = NameKeyUserSerializer . _associations [ :profile ]
230
222
@association . embed = :ids
You can’t perform that action at this time.
0 commit comments