Sha256: f12db61ddfadef1dea424adf992c243ef192ecb92f68cb6be4f29193892ac6e3

Contents?: true

Size: 1.23 KB

Versions: 22

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'

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

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

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

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

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

  describe '#update' do
    let(:content_asset) { single_content_asset || create_content_asset }
    subject { content_assets.update(content_asset._id, source: asset_io('locomotive.png')) }
    it { expect(subject.url).to match /locomotive.png$/ }
  end

  describe '#destroy' do
    let(:content_asset) { single_content_asset || create_content_asset }
    subject { content_assets.destroy(content_asset._id) }
    it { expect(subject._id).not_to eq nil }
  end

  def create_content_asset
    content_assets.create(source: asset_io('rails.png'))
  end

  def single_content_asset
    content_assets.all.detect { |a| a.url =~ /rails.png$/ }
  end

end

Version data entries

22 entries across 22 versions & 1 rubygems

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