spec/serializer_spec.rb in jsonapi-serializers-0.14.0 vs spec/serializer_spec.rb in jsonapi-serializers-0.15.0

- old
+ new

@@ -516,9 +516,17 @@ post = create(:post) expect(JSONAPI::Serializer.serialize(post)).to eq({ 'data' => serialize_primary(post, {serializer: MyApp::PostSerializer}), }) end + it 'can include a top level jsonapi node' do + post = create(:post) + jsonapi_version = {'version' => '1.0'} + expect(JSONAPI::Serializer.serialize(post, jsonapi: jsonapi_version)).to eq({ + 'jsonapi' => {'version' => '1.0'}, + 'data' => serialize_primary(post, {serializer: MyApp::PostSerializer}), + }) + end it 'can include a top level meta node' do post = create(:post) meta = {authors: ['Yehuda Katz', 'Steve Klabnik'], copyright: 'Copyright 2015 Example Corp.'} expect(JSONAPI::Serializer.serialize(post, meta: meta)).to eq({ 'meta' => meta,