Do not convert root and meta_key to Strings

This commit is contained in:
Santiago Pastorino
2013-09-15 23:43:41 -03:00
parent 75e9a2599d
commit daa9304398
5 changed files with 30 additions and 30 deletions

View File

@@ -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