Rename attribute with :key (0.8.x compatibility)

This commit is contained in:
Gary Gordon
2014-11-06 11:10:15 -05:00
parent ac37570bff
commit 08716d20c9
4 changed files with 48 additions and 1 deletions

View File

@@ -0,0 +1,23 @@
require 'test_helper'
module ActiveModel
class Serializer
class AttributeTest < Minitest::Test
def setup
@blog = Blog.new({ id: 1, name: 'AMS Hints' })
@blog_serializer = AlternateBlogSerializer.new(@blog)
end
def test_attributes_definition
assert_equal([:id, :title],
@blog_serializer.class._attributes)
end
def test_json_serializable_hash
adapter = ActiveModel::Serializer::Adapter::Json.new(@blog_serializer)
assert_equal({:id=>1, :title=>"AMS Hints"}, adapter.serializable_hash)
end
end
end
end