Allow using root = false in initialize

This commit is contained in:
Santiago Pastorino
2013-09-14 21:15:04 -03:00
parent 8462a73f3a
commit 626a85bc3e
4 changed files with 23 additions and 2 deletions

View File

@@ -45,6 +45,15 @@ module ActiveModel
}
}, @serializer.as_json(root: 'argument'))
end
def test_using_false_root_in_initializer_takes_precedence
ProfileSerializer._root = 'root'
@serializer = ProfileSerializer.new(@profile, root: false)
assert_equal({
'name' => 'Name 1', 'description' => 'Description 1'
}, @serializer.as_json)
end
end
class RootInSerializerTest < ActiveModel::TestCase