Sha256: 16cd4cd075ef5bf2bdb8f610457596fe7da941ef8404c545796755f91a3360d4
Contents?: true
Size: 1001 Bytes
Versions: 2
Compression:
Stored size: 1001 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(:self, '/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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
yaks-0.4.4 | spec/unit/yaks/format/json_api_spec.rb |
yaks-0.4.3 | spec/unit/yaks/format/json_api_spec.rb |