Update format of links

This commit is contained in:
Mateo Murphy
2015-03-20 12:04:22 -04:00
parent 83c2854094
commit 0f55f21266
10 changed files with 198 additions and 107 deletions

View File

@@ -30,12 +30,25 @@ module ActiveModel
end
def test_includes_bio_id
assert_equal("43", @adapter.serializable_hash[:data][:links][:bio])
expected = { linkage: { type: "bio", id: "43" } }
assert_equal(expected, @adapter.serializable_hash[:data][:links][:bio])
end
def test_includes_linked_bio
@adapter = ActiveModel::Serializer::Adapter::JsonApi.new(@serializer, include: 'bio')
assert_equal([{id: "43", :content=>"AMS Contributor", :links=>{:author=>"1"}}], @adapter.serializable_hash[:linked][:bios])
expected = [
{
id: "43",
content:"AMS Contributor",
links: {
author: { linkage: { type: "author", id: "1" } }
}
}
]
assert_equal(expected, @adapter.serializable_hash[:linked][:bios])
end
end
end