Sha256: 6b9bf3766b74a9577ae2266e15d13a28e4450c4a33682ba854cdb71aaab56284
Contents?: true
Size: 1.02 KB
Versions: 7
Compression:
Stored size: 1.02 KB
Contents
require 'spec_helper' describe 'Resource Building Examples' do it 'can deal with arrays' do response = Contentful::Response.new raw_fixture('link_array') resource = Contentful::ResourceBuilder.new(create_client, response).run expect( resource.fields[:links] ).to be_a Array expect( resource.fields[:links].first ).to be_a Contentful::Link end it 'replaces links with included versions if present' do response = Contentful::Response.new raw_fixture('includes') resource = Contentful::ResourceBuilder.new(create_client, response).run.first expect( resource.fields[:links] ).to be_a Array expect( resource.fields[:links].first ).to be_a Contentful::Entry end it 'can also reference itself' do response = Contentful::Response.new raw_fixture('self_link') resource = Contentful::ResourceBuilder.new(create_client, response).run.first other_resource = resource.fields[:e] expect( other_resource ).to be_a Contentful::Entry expect( other_resource.fields[:e] ).to be resource end end
Version data entries
7 entries across 7 versions & 1 rubygems