spec/unit/yaks/collection_resource_spec.rb in yaks-0.9.0 vs spec/unit/yaks/collection_resource_spec.rb in yaks-0.10.0

- old
+ new

@@ -20,45 +20,53 @@ type: 'order', links: [ Yaks::Resource::Link.new(rel: 'http://rels/summary', uri: 'http://order/10/summary'), Yaks::Resource::Link.new(rel: :profile, uri: 'http://rels/collection') ], - attributes: { total: 10.00 }, + attributes: {total: 10.00}, members: [ Yaks::Resource.new( type: 'order', links: [Yaks::Resource::Link.new(rel: :self, uri: 'http://order/10')], - attributes: { customer: 'John Doe', price: 10.00 } + attributes: {customer: 'John Doe', price: 10.00} ) ], rels: ['http://api.example.org/rels/orders'] } } its(:type) { should eql 'order' } - its(:links) { should eql [ + its(:links) { + should eql [ Yaks::Resource::Link.new(rel: 'http://rels/summary', uri: 'http://order/10/summary'), Yaks::Resource::Link.new(rel: :profile, uri: 'http://rels/collection') ] } - its(:attributes) { should eql( total: 10.00 ) } - its(:members) { should eql [ + its(:attributes) { should eql(total: 10.00) } + its(:members) { + should eql [ Yaks::Resource.new( type: 'order', links: [Yaks::Resource::Link.new(rel: :self, uri: 'http://order/10')], - attributes: { customer: 'John Doe', price: 10.00 } + attributes: {customer: 'John Doe', price: 10.00} ) ] } its(:rels) { should eq ['http://api.example.org/rels/orders'] } its(:subresources) { should eql [] } end describe '#seq' do - let(:init_opts) { { members: [1,2,3] } } + let(:init_opts) { {members: [1, 2, 3]} } it 'iterates over the members' do - expect(subject.seq.map(&:next)).to eql [2,3,4] + expect(subject.seq.map(&:next)).to eql [2, 3, 4] + end + end + + describe '#collection?' do + it 'should always be true' do + expect(subject.collection?).to be true end end end