Add support for toplevel JSON API links.

This commit is contained in:
Lucas Hosseini
2015-10-06 19:44:44 +02:00
parent d02cd30fe5
commit 54303b6290
3 changed files with 38 additions and 1 deletions

View File

@@ -0,0 +1,32 @@
require 'test_helper'
module ActiveModel
class Serializer
module Adapter
class JsonApi
class LinksTest < Minitest::Test
def setup
@post = Post.new(id: 1337, comments: [], author: nil)
end
def test_toplevel_links
hash = ActiveModel::SerializableResource.new(
@post,
adapter: :json_api,
links: {
self: {
href: '//posts'
}
}).serializable_hash
expected = {
self: {
href: '//posts'
}
}
assert_equal(expected, hash[:links])
end
end
end
end
end
end