@@ -25,6 +25,7 @@ def serialize_primary(object, options = {})
2525 'links' => {
2626 'self' => '/posts/1' ,
2727 } ,
28+ 'relationships' => { } ,
2829 } )
2930 end
3031 it 'can serialize primary data for a simple object with a long name' do
@@ -38,6 +39,8 @@ def serialize_primary(object, options = {})
3839 } ,
3940 'links' => {
4041 'self' => '/long-comments/1' ,
42+ } ,
43+ 'relationships' => {
4144 'user' => {
4245 'self' => '/long-comments/1/links/user' ,
4346 'related' => '/long-comments/1/user' ,
@@ -62,6 +65,7 @@ def serialize_primary(object, options = {})
6265 'links' => {
6366 'self' => '/posts/1' ,
6467 } ,
68+ 'relationships' => { } ,
6569 'meta' => {
6670 'copyright' => 'Copyright 2015 Example Corp.' ,
6771 'authors' => [
@@ -83,6 +87,8 @@ def serialize_primary(object, options = {})
8387 } ,
8488 'links' => {
8589 'self' => '/posts/1' ,
90+ } ,
91+ 'relationships' => {
8692 # Both to-one and to-many links are present, but neither include linkage:
8793 'author' => {
8894 'self' => '/posts/1/links/author' ,
@@ -113,6 +119,8 @@ def serialize_primary(object, options = {})
113119 } ,
114120 'links' => {
115121 'self' => '/posts/1' ,
122+ } ,
123+ 'relationships' => {
116124 'author' => {
117125 'self' => '/posts/1/links/author' ,
118126 'related' => '/posts/1/author' ,
@@ -145,6 +153,8 @@ def serialize_primary(object, options = {})
145153 } ,
146154 'links' => {
147155 'self' => '/posts/1' ,
156+ } ,
157+ 'relationships' => {
148158 'author' => {
149159 'self' => '/posts/1/links/author' ,
150160 'related' => '/posts/1/author' ,
@@ -180,6 +190,8 @@ def serialize_primary(object, options = {})
180190 } ,
181191 'links' => {
182192 'self' => '/posts/1' ,
193+ } ,
194+ 'relationships' => {
183195 'author' => {
184196 'self' => '/posts/1/links/author' ,
185197 'related' => '/posts/1/author' ,
@@ -213,6 +225,8 @@ def serialize_primary(object, options = {})
213225 } ,
214226 'links' => {
215227 'self' => '/posts/1' ,
228+ } ,
229+ 'relationships' => {
216230 'author' => {
217231 'self' => '/posts/1/links/author' ,
218232 'related' => '/posts/1/author' ,
@@ -414,7 +428,7 @@ def serialize_primary(object, options = {})
414428 ] ,
415429 }
416430 includes = [ 'long-comments.post.author' ]
417- actual_data = JSONAPI ::Serializer . serialize ( post , include : [ 'long-comments.post.author' ] )
431+ actual_data = JSONAPI ::Serializer . serialize ( post , include : includes )
418432 # Multiple expectations for better diff output for debugging.
419433 expect ( actual_data [ 'data' ] ) . to eq ( expected_data [ 'data' ] )
420434 expect ( actual_data [ 'included' ] ) . to eq ( expected_data [ 'included' ] )
0 commit comments