Sha256: c3d3eac0d9325d40ca5c5577e9133c8fb4ee6dab78095b5b2ea50c19e788bde3

Contents?: true

Size: 1 KB

Versions: 8

Compression:

Stored size: 1 KB

Contents

require 'spec_helper'

describe Contentful::Link do
  let(:client) { create_client }
  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(client)).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(client)).to be_a Contentful::ContentType
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
contentful-2.1.3 spec/link_spec.rb
contentful-2.1.2 spec/link_spec.rb
contentful-2.1.1 spec/link_spec.rb
contentful-2.1.0 spec/link_spec.rb
contentful-2.0.3 spec/link_spec.rb
contentful-2.0.2 spec/link_spec.rb
contentful-2.0.1 spec/link_spec.rb
contentful-2.0.0 spec/link_spec.rb