spec/serializer_spec.rb in jsonapi-serializers-0.12.0 vs spec/serializer_spec.rb in jsonapi-serializers-0.13.0
- old
+ new
@@ -524,9 +524,17 @@
expect(JSONAPI::Serializer.serialize(post, meta: meta)).to eq({
'meta' => meta,
'data' => serialize_primary(post, {serializer: MyApp::PostSerializer}),
})
end
+ it 'can include a top level links node' do
+ post = create(:post)
+ links = {self: 'http://example.com/posts'}
+ expect(JSONAPI::Serializer.serialize(post, links: links)).to eq({
+ 'links' => links,
+ 'data' => serialize_primary(post, {serializer: MyApp::PostSerializer}),
+ })
+ end
# TODO: remove this code on next major release
it 'can include a top level errors node - deprecated' do
post = create(:post)
errors = [
{