Spec for linked resource type name demodulization

This commit is contained in:
Robbie Pitts
2015-01-11 16:10:02 -05:00
parent 90023b1af7
commit b626ec8f14
4 changed files with 38 additions and 3 deletions

View File

@@ -78,10 +78,15 @@ module ActiveModel
assert_nil adapter.serializable_hash[:linked]
end
def test_include_type_for_association_when_is_different_than_name
def test_include_type_for_association_when_different_than_name
serializer = BlogSerializer.new(@blog)
adapter = ActiveModel::Serializer::Adapter::JsonApi.new(serializer)
assert_equal({type: "posts", ids: ["1"]}, adapter.serializable_hash[:blogs][:links][:articles])
actual = adapter.serializable_hash[:blogs][:links][:articles]
expected = {
type: "posts",
ids: ["1"]
}
assert_equal(expected, actual)
end
end
end