mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Do not convert root and meta_key to Strings
This commit is contained in:
@@ -8,29 +8,29 @@ module ActiveModel
|
||||
end
|
||||
|
||||
def test_meta
|
||||
profile_serializer = ProfileSerializer.new(@profile, root: 'profile', meta: { 'total' => 10 })
|
||||
profile_serializer = ProfileSerializer.new(@profile, root: 'profile', meta: { total: 10 })
|
||||
|
||||
assert_equal({
|
||||
'profile' => {
|
||||
name: 'Name 1',
|
||||
description: 'Description 1'
|
||||
},
|
||||
'meta' => {
|
||||
'total' => 10
|
||||
meta: {
|
||||
total: 10
|
||||
}
|
||||
}, profile_serializer.as_json)
|
||||
end
|
||||
|
||||
def test_meta_using_meta_key
|
||||
profile_serializer = ProfileSerializer.new(@profile, root: 'profile', meta_key: :my_meta, my_meta: { 'total' => 10 })
|
||||
profile_serializer = ProfileSerializer.new(@profile, root: 'profile', meta_key: :my_meta, my_meta: { total: 10 })
|
||||
|
||||
assert_equal({
|
||||
'profile' => {
|
||||
name: 'Name 1',
|
||||
description: 'Description 1'
|
||||
},
|
||||
'my_meta' => {
|
||||
'total' => 10
|
||||
my_meta: {
|
||||
total: 10
|
||||
}
|
||||
}, profile_serializer.as_json)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user