Sha256: 2c933023a2f0678d0676af6892c92584150f9e23a3def1e5a852bd952b40f7c6

Contents?: true

Size: 978 Bytes

Versions: 18

Compression:

Stored size: 978 Bytes

Contents

require 'spec_helper'

describe Contentful::Link do
  let(:entry) { vcr('entry') { create_client.entry('nyancat') } }
  let(:link) { entry.space }
  let(:content_type_link) { entry.content_type }

  describe 'SystemProperties' do
    it 'has a #sys getter returning a hash with symbol keys' do
      expect(link.sys).to be_a Hash
      expect(link.sys.keys.sample).to be_a Symbol
    end

    it 'has #id' do
      expect(link.id).to eq 'cfexampleapi'
    end

    it 'has #type' do
      expect(link.type).to eq 'Link'
    end

    it 'has #link_type' do
      expect(link.link_type).to eq 'Space'
    end
  end

  describe '#resolve' do
    it 'queries the api for the resource' do
      vcr('space')do
        expect(link.resolve).to be_a Contentful::Space
      end
    end

    it 'queries the api for the resource (different link object)' do
      vcr('content_type')do
        expect(content_type_link.resolve).to be_a Contentful::ContentType
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
contentful-1.2.2 spec/link_spec.rb
contentful-1.2.1 spec/link_spec.rb
contentful-1.2.0 spec/link_spec.rb
contentful-1.1.1 spec/link_spec.rb
contentful-1.1.0 spec/link_spec.rb
contentful-1.0.2 spec/link_spec.rb
contentful-1.0.1 spec/link_spec.rb
contentful-1.0.0 spec/link_spec.rb
contentful-0.12.0 spec/link_spec.rb
contentful-0.11.0 spec/link_spec.rb
contentful-0.10.0 spec/link_spec.rb
contentful-0.9.0 spec/link_spec.rb
contentful-0.8.0 spec/link_spec.rb
contentful-0.7.0 spec/link_spec.rb
contentful-0.6.0 spec/link_spec.rb
contentful-0.5.0 spec/link_spec.rb
contentful-0.4.0 spec/link_spec.rb
contentful-0.3.5 spec/link_spec.rb