Sha256: f539ee276e178053cbbb1625326affe9250f0ddb71ad0b1632ab6ef1c5ce9cc0

Contents?: true

Size: 1.24 KB

Versions: 10

Compression:

Stored size: 1.24 KB

Contents

require 'spec_helper'

describe Contentful::ContentType do
  let(:entry){ vcr('entry'){ create_client.entry 'nyancat' } }

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

    it 'has #id' do
      expect( entry.id ).to eq "nyancat"
    end

    it 'has #type' do
      expect( entry.type ).to eq "Entry"
    end

    it 'has #space' do
      expect( entry.space ).to be_a Contentful::Link
    end

    it 'has #content_type' do
      expect( entry.content_type ).to be_a Contentful::Link
    end

    it 'has #created_at' do
      expect( entry.created_at ).to be_a DateTime
    end

    it 'has #updated_at' do
      expect( entry.updated_at ).to be_a DateTime
    end

    it 'has #revision' do
      expect( entry.revision ).to eq 5
    end
  end

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

    it "contains the entry's fields" do
      expect( entry.fields[:color] ).to eq "rainbow"
      expect( entry.fields[:bestFriend] ).to be_a Contentful::Link
    end
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
contentful-0.3.4 spec/entry_spec.rb
contentful-0.3.3 spec/entry_spec.rb
contentful-0.3.2 spec/entry_spec.rb
contentful-0.3.1 spec/entry_spec.rb
contentful-0.3.0 spec/entry_spec.rb
contentful-0.2.0 spec/entry_spec.rb
contentful-0.1.3 spec/entry_spec.rb
contentful-0.1.2 spec/entry_spec.rb
contentful-0.1.1 spec/entry_spec.rb
contentful-0.1.0 spec/entry_spec.rb