Sha256: 0047053a8d40efb834e07e49ce77ac06993ce7a3377657c70b1149cc25d10cd6

Contents?: true

Size: 1.14 KB

Versions: 22

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'

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

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

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

  describe '#all' do
    subject { snippets.all }
    it { expect(subject).not_to eq nil }
  end

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

  describe '#update' do
    let(:snippet) { snippets.all.detect { |s| s.slug == 'footer' } || create_snippet }
    subject { snippets.update(snippet._id, template: 'Locomotive rocks. period') }
    it { expect(subject.template).to eq 'Locomotive rocks. period' }
  end

  describe '#destroy' do
    let(:snippet) { snippets.all.detect { |s| s.slug == 'footer' } || create_snippet }
    subject { snippets.destroy(snippet._id) }
    it { expect(subject._id).not_to eq nil }
  end

  def create_snippet
    snippets.create(name: 'Footer', slug: 'footer', template: 'Locomotive rocks!')
  end

end

Version data entries

22 entries across 22 versions & 1 rubygems

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