Sha256: 6c8caa3209c808480448e067f4bc224bd361774ea876028d87ab3f688203922b

Contents?: true

Size: 1.21 KB

Versions: 20

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

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

describe Locomotive::Steam::SnippetRepository do

  shared_examples_for 'a repository' do

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

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

    describe '#by_slug' do
      subject { repository.by_slug('a_complicated-one') }
      it { expect(subject).not_to eq nil }
    end

  end

  context 'MongoDB' do

    it_should_behave_like 'a repository' do

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

    end

  end

  context 'Filesystem' do

    it_should_behave_like 'a repository' do

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

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

    end

  end

end

Version data entries

20 entries across 20 versions & 1 rubygems

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