spec/serializer_spec.rb in jsonapi-serializers-0.2.2 vs spec/serializer_spec.rb in jsonapi-serializers-0.2.3
- old
+ new
@@ -273,9 +273,21 @@
},
},
})
end
end
+ it 'can serialize primary data for an empty serializer with no attributes' do
+ post = create(:post)
+ primary_data = serialize_primary(post, {serializer: MyApp::EmptySerializer})
+ expect(primary_data).to eq({
+ 'id' => '1',
+ 'type' => 'posts',
+ 'attributes' => {},
+ 'links' => {
+ 'self' => '/posts/1',
+ },
+ })
+ end
end
describe 'JSONAPI::Serializer.serialize' do
# The following tests rely on the fact that serialize_primary has been tested above, so object
# primary data is not explicitly tested here. If things are broken, look above here first.
\ No newline at end of file