Sha256: 355ef8e3eb0f58b5131233349ef0c4e1490ca1a351745805a041f273ba91d500

Contents?: true

Size: 1.21 KB

Versions: 27

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: 'steam_test', 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

27 entries across 27 versions & 1 rubygems

Version Path
locomotivecms_steam-1.4.0.rc1 spec/integration/repositories/snippet_repository_spec.rb
locomotivecms_steam-1.4.0.pre.rc.1 spec/integration/repositories/snippet_repository_spec.rb
locomotivecms_steam-1.3.0 spec/integration/repositories/snippet_repository_spec.rb
locomotivecms_steam-1.3.0.rc2 spec/integration/repositories/snippet_repository_spec.rb
locomotivecms_steam-1.1.2 spec/integration/repositories/snippet_repository_spec.rb
locomotivecms_steam-1.2.1 spec/integration/repositories/snippet_repository_spec.rb
locomotivecms_steam-1.3.0.rc1 spec/integration/repositories/snippet_repository_spec.rb
locomotivecms_steam-1.2.0 spec/integration/repositories/snippet_repository_spec.rb
locomotivecms_steam-1.2.0.rc3 spec/integration/repositories/snippet_repository_spec.rb
locomotivecms_steam-1.2.0.rc2 spec/integration/repositories/snippet_repository_spec.rb
locomotivecms_steam-1.2.0.rc1 spec/integration/repositories/snippet_repository_spec.rb
locomotivecms_steam-1.2.0.beta1 spec/integration/repositories/snippet_repository_spec.rb
locomotivecms_steam-1.1.1 spec/integration/repositories/snippet_repository_spec.rb
locomotivecms_steam-1.1.0 spec/integration/repositories/snippet_repository_spec.rb
locomotivecms_steam-1.1.0.rc3 spec/integration/repositories/snippet_repository_spec.rb
locomotivecms_steam-1.1.0.rc2 spec/integration/repositories/snippet_repository_spec.rb
locomotivecms_steam-1.1.0.rc1 spec/integration/repositories/snippet_repository_spec.rb
locomotivecms_steam-1.0.1 spec/integration/repositories/snippet_repository_spec.rb
locomotivecms_steam-1.0.0 spec/integration/repositories/snippet_repository_spec.rb
locomotivecms_steam-1.0.0.rc10 spec/integration/repositories/snippet_repository_spec.rb