Remove unneeded method aliasing of attribute reader: object, with the underscored class name of serializer, to fix issue where a model's attribute name matches that of the underscored prefix of the serializer

This commit is contained in:
Kevin Tham
2012-11-24 23:55:14 -08:00
parent 720f1dabf8
commit 14a35ab2f8
3 changed files with 19 additions and 2 deletions

View File

@@ -29,6 +29,17 @@ class SerializerTest < ActiveModel::TestCase
}, hash)
end
def test_attribute_method_with_name_as_serializer_prefix
object = SomeObject.new("something")
object_serializer = SomeSerializer.new(object, {})
hash = object_serializer.as_json
assert_equal({
:some => { :some => "something" }
}, hash)
end
def test_serializer_receives_scope
user = User.new
user_serializer = UserSerializer.new(user, :scope => {:scope => true})