Sha256: 2cf981d55fd1df508d537ae6b08952747a222f4cea3099f044bb7a8cf08006d4

Contents?: true

Size: 1.05 KB

Versions: 22

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'

describe Locomotive::Coal::Resources::Sites, order: :defined do

  before { VCR.insert_cassette 'sites', record: :new_episodes }
  after  { VCR.eject_cassette }

  let(:uri)         { TEST_API_V3_URI }
  let(:credentials) { { email: TEST_API_EMAIL, token: api_token } }
  let(:sites)       { described_class.new(uri, credentials) }

  describe '#all' do

    subject { sites.all }
    it { expect(subject.size).to be > 0 }

    describe 'first site' do
      subject { sites.all.first }
      it { expect(subject.name).not_to eq nil }
    end
  end

  describe '#create' do
    subject { create_site }
    it { expect(subject._id).not_to eq nil }
  end

  describe '#by_handle' do
    subject { sites.by_handle('sample') }
    it { expect(subject._id).not_to eq nil }
  end

  describe '#destroy' do
    let(:new_site) { sites.by_handle('acme') || create_site }
    subject { sites.destroy(new_site._id) }
    it { expect(subject._id).not_to eq nil }
  end

  def create_site
    sites.create(name: 'Acme', handle: 'acme', locales: ['en'])
  end

end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
locomotivecms_coal-1.7.0 spec/integration/resources/sites_spec.rb
locomotivecms_coal-1.6.0 spec/integration/resources/sites_spec.rb
locomotivecms_coal-1.6.0.rc2 spec/integration/resources/sites_spec.rb
locomotivecms_coal-1.6.0.rc1 spec/integration/resources/sites_spec.rb
locomotivecms_coal-1.6.0.beta1 spec/integration/resources/sites_spec.rb
locomotivecms_coal-1.5.1 spec/integration/resources/sites_spec.rb
locomotivecms_coal-1.5.0 spec/integration/resources/sites_spec.rb
locomotivecms_coal-1.4.0 spec/integration/resources/sites_spec.rb
locomotivecms_coal-1.3.0 spec/integration/resources/sites_spec.rb
locomotivecms_coal-1.3.0.rc1 spec/integration/resources/sites_spec.rb
locomotivecms_coal-1.3.0.rc spec/integration/resources/sites_spec.rb
locomotivecms_coal-1.2.0 spec/integration/resources/sites_spec.rb
locomotivecms_coal-1.1.0 spec/integration/resources/sites_spec.rb
locomotivecms_coal-1.0.0 spec/integration/resources/sites_spec.rb
locomotivecms_coal-1.0.0.rc4 spec/integration/resources/sites_spec.rb
locomotivecms_coal-1.0.0.rc3 spec/integration/resources/sites_spec.rb
locomotivecms_coal-1.0.0.rc2 spec/integration/resources/sites_spec.rb
locomotivecms_coal-1.0.0.rc1 spec/integration/resources/sites_spec.rb
locomotivecms_coal-1.0.0.pre.beta.2 spec/integration/resources/sites_spec.rb
locomotivecms_coal-1.0.0.pre.beta.1 spec/integration/resources/sites_spec.rb