Sha256: 5664db81d65fe542b3226d51331dc3ed769a084812741616c9da976813d7c0d3
Contents?: true
Size: 1.38 KB
Versions: 2
Compression:
Stored size: 1.38 KB
Contents
require 'test_helper' module ActiveModel class Serializer class Adapter class JsonApi class HasManyEmbedIdsTest < Minitest::Test def setup @author = Author.new(name: 'Steve K.') @author.bio = nil @author.roles = nil @first_post = Post.new(id: 1, title: 'Hello!!', body: 'Hello, world!!') @second_post = Post.new(id: 2, title: 'New Post', body: 'Body') @author.posts = [@first_post, @second_post] @first_post.author = @author @second_post.author = @author @first_post.comments = [] @second_post.comments = [] @blog = Blog.new(id: 23, name: 'AMS Blog') @first_post.blog = @blog @second_post.blog = nil @serializer = AuthorSerializer.new(@author) @adapter = ActiveModel::Serializer::Adapter::JsonApi.new(@serializer) end def test_includes_comment_ids expected = { linkage: [ { type: "posts", id: "1"}, { type: "posts", id: "2"} ] } assert_equal(expected, @adapter.serializable_hash[:data][:links][:posts]) end def test_no_includes_linked_comments assert_nil @adapter.serializable_hash[:linked] end end end end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
cm-active_model_serializers-0.10.0.rc1.1 | test/adapter/json_api/has_many_embed_ids_test.rb |
active_model_serializers-0.10.0.rc1 | test/adapter/json_api/has_many_embed_ids_test.rb |