Sha256: 3c63c0fb60cb3deb9e9c46b1cb7e3de5a730e38acf8c58e52fe6b7f546a1a7d2
Contents?: true
Size: 1007 Bytes
Versions: 9
Compression:
Stored size: 1007 Bytes
Contents
require 'spec_helper' # Mainly tested through the acceptance tests, here covering a few specific edge cases RSpec.describe Yaks::Format::JsonAPI do let(:format) { Yaks::Format::JsonAPI.new } context 'with no subresources' do let(:resource) { Yaks::Resource.new(type: 'wizard', attributes: {foo: :bar}) } it 'should not include a "linked" key' do expect(format.call(resource)).to eql( {'wizards' => [{foo: :bar}]} ) end end context 'with both a "href" attribute and a self link' do let(:resource) { Yaks::Resource.new( type: 'wizard', attributes: { href: '/the/href' }, links: [ Yaks::Resource::Link.new(rel: :self, uri: '/the/self/link') ] ) } it 'should give preference to the href attribute' do expect(format.call(resource)).to eql( {'wizards' => [ { href: '/the/href' } ] } ) end end end
Version data entries
9 entries across 9 versions & 1 rubygems