Sha256: 66463c6778ba488202d3b699d7ee8410c989893c0956ac166755e1074fc11bab

Contents?: true

Size: 1.68 KB

Versions: 17

Compression:

Stored size: 1.68 KB

Contents

require 'spec_helper'

require_relative '../../../lib/locomotive/steam/adapters/filesystem.rb'
require_relative '../../../lib/locomotive/steam/adapters/mongodb.rb'

describe Locomotive::Steam::ThemeAssetRepository do

  let(:site)        { Locomotive::Steam::Site.new(_id: site_id, locales: %w(en fr nb)) }
  let(:repository)  { described_class.new(adapter, site, :en) }

  context 'MongoDB' do

    let(:site_id) { mongodb_site_id }
    let(:adapter) { Locomotive::Steam::MongoDBAdapter.new(database: mongodb_database, hosts: ['127.0.0.1:27017']) }

    describe '#all' do
      subject { repository.all }
      it { expect(subject.size).to eq 16 }
    end

    describe '#url_for' do
      subject { repository.url_for('stylesheets/application.css') }
      it { is_expected.to eq "/sites/#{mongodb_site_id}/theme/stylesheets/application.css" }
    end

    describe '#checksums' do
      subject { repository.checksums }
      it { expect(subject.size).to eq 16 }
      it { expect(subject['stylesheets/application.css']).to eq 'bcf663fd61d87846a60496249854d81a' }
    end

  end

  context 'Filesystem' do

    let(:site_id) { 1 }
    let(:adapter) { Locomotive::Steam::FilesystemAdapter.new(default_fixture_site_path) }

    describe '#all' do
      subject { repository.all }
      it { expect(subject.size).to eq 16 }
    end

    describe '#url_for' do
      subject { repository.url_for('stylesheets/application.css') }
      it { is_expected.to eq '/stylesheets/application.css' }
    end

    describe '#checksums' do
      subject { repository.checksums }
      it { expect(subject).to eq({}) }
    end

    after(:all) { Locomotive::Steam::Adapters::Filesystem::SimpleCacheStore.new.clear }

  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
locomotivecms_steam-1.8.0.alpha2 spec/integration/repositories/theme_asset_repository_spec.rb
locomotivecms_steam-1.8.0.alpha1 spec/integration/repositories/theme_asset_repository_spec.rb
locomotivecms_steam-1.7.1 spec/integration/repositories/theme_asset_repository_spec.rb
locomotivecms_steam-1.7.0 spec/integration/repositories/theme_asset_repository_spec.rb
locomotivecms_steam-1.6.1 spec/integration/repositories/theme_asset_repository_spec.rb
locomotivecms_steam-1.6.0 spec/integration/repositories/theme_asset_repository_spec.rb
locomotivecms_steam-1.6.0.rc1 spec/integration/repositories/theme_asset_repository_spec.rb
locomotivecms_steam-1.6.0.beta1 spec/integration/repositories/theme_asset_repository_spec.rb
locomotivecms_steam-1.5.3 spec/integration/repositories/theme_asset_repository_spec.rb
locomotivecms_steam-1.5.2 spec/integration/repositories/theme_asset_repository_spec.rb
locomotivecms_steam-1.5.1 spec/integration/repositories/theme_asset_repository_spec.rb
locomotivecms_steam-1.5.0 spec/integration/repositories/theme_asset_repository_spec.rb
locomotivecms_steam-1.5.0.rc1 spec/integration/repositories/theme_asset_repository_spec.rb
locomotivecms_steam-1.5.0.rc0 spec/integration/repositories/theme_asset_repository_spec.rb
locomotivecms_steam-1.5.0.beta3 spec/integration/repositories/theme_asset_repository_spec.rb
locomotivecms_steam-1.5.0.beta2 spec/integration/repositories/theme_asset_repository_spec.rb
locomotivecms_steam-1.5.0.beta1 spec/integration/repositories/theme_asset_repository_spec.rb