spec/serializer_spec.rb in jsonapi-serializers-0.4.0 vs spec/serializer_spec.rb in jsonapi-serializers-0.5.0

- old
+ new

@@ -421,11 +421,11 @@ include_linkages: ['author'], }) expect(JSONAPI::Serializer.serialize(post, include: ['author'])).to eq({ 'data' => expected_primary_data, 'included' => [ - serialize_primary(post.author, {serializer: MyApp::UserSerializer}), + serialize_primary(post.author, {serializer: MyAppOtherNamespace::UserSerializer}), ], }) end it 'handles include of empty to-many relationships with compound document' do post = create(:post, :with_author, long_comments: []) @@ -516,11 +516,11 @@ # and now wants to fetch the associated authors without fetching the comments again. # http://jsonapi.org/format/#fetching-includes 'data' => serialize_primary(post, {serializer: MyApp::PostSerializer}), 'included' => [ # Only the author is included: - serialize_primary(post.author, {serializer: MyApp::UserSerializer}), + serialize_primary(post.author, {serializer: MyAppOtherNamespace::UserSerializer}), ], } includes = ['long-comments.post.author'] actual_data = JSONAPI::Serializer.serialize(post, include: includes) # Multiple expectations for better diff output for debugging. @@ -540,12 +540,12 @@ expected_data = { # Same note about primary data linkages as above. 'data' => serialize_primary(post, {serializer: MyApp::PostSerializer}), 'included' => [ - serialize_primary(first_user, {serializer: MyApp::UserSerializer}), - serialize_primary(second_user, {serializer: MyApp::UserSerializer}), + serialize_primary(first_user, {serializer: MyAppOtherNamespace::UserSerializer}), + serialize_primary(second_user, {serializer: MyAppOtherNamespace::UserSerializer}), ], } includes = ['long-comments.user'] actual_data = JSONAPI::Serializer.serialize(post, include: includes) @@ -569,11 +569,11 @@ serialize_primary(long_comments.first, { serializer: MyApp::LongCommentSerializer, include_linkages: ['user'], }), # Note: post.author does not show up here because it was not included. - serialize_primary(comment_user, {serializer: MyApp::UserSerializer}), + serialize_primary(comment_user, {serializer: MyAppOtherNamespace::UserSerializer}), ], } includes = ['long-comments', 'long-comments.user'] actual_data = JSONAPI::Serializer.serialize(post, include: includes) @@ -596,10 +596,10 @@ expected_data = { 'data' => expected_primary_data, 'included' => [ serialize_primary(long_comments.first, {serializer: MyApp::LongCommentSerializer}), serialize_primary(long_comments.last, {serializer: MyApp::LongCommentSerializer}), - serialize_primary(post.author, {serializer: MyApp::UserSerializer}), + serialize_primary(post.author, {serializer: MyAppOtherNamespace::UserSerializer}), ], } # Also test that it handles string include arguments. includes = 'long-comments, long-comments.post.author' actual_data = JSONAPI::Serializer.serialize(post, include: includes)