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

- old
+ new

@@ -126,9 +126,24 @@ 'author' => {}, 'long-comments' => {}, }, }) end + it 'serializes object when multiple attributes are declared once' do + post = create(:post) + primary_data = serialize_primary(post, {serializer: MyApp::MultipleAttributesSerializer}) + expect(primary_data).to eq({ + 'id' => '1', + 'type' => 'posts', + 'attributes' => { + 'title' => 'Title for Post 1', + 'body' => 'Body for Post 1', + }, + 'links' => { + 'self' => '/posts/1', + } + }) + end end context 'with linkage includes' do it 'can serialize primary data for a null to-one relationship' do post = create(:post, author: nil) options = {