Sha256: 4e2dd8c3065a851c2d96ecfe4ca8d5fddca09adf59d764aa9da9337de6421bc1

Contents?: true

Size: 1.25 KB

Versions: 22

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

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

describe Locomotive::Steam::TranslationRepository 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 1 }
    end

    describe '#by_key' do
      subject { repository.by_key('powered_by') }
      it { expect(subject.values).to eq({ 'en' => 'Powered by', 'fr' => 'Propulsé par' }) }
    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

22 entries across 22 versions & 1 rubygems

Version Path
locomotivecms_steam-1.1.2 spec/integration/repositories/translation_repository_spec.rb
locomotivecms_steam-1.2.1 spec/integration/repositories/translation_repository_spec.rb
locomotivecms_steam-1.2.0 spec/integration/repositories/translation_repository_spec.rb
locomotivecms_steam-1.2.0.rc3 spec/integration/repositories/translation_repository_spec.rb
locomotivecms_steam-1.2.0.rc2 spec/integration/repositories/translation_repository_spec.rb
locomotivecms_steam-1.2.0.rc1 spec/integration/repositories/translation_repository_spec.rb
locomotivecms_steam-1.2.0.beta1 spec/integration/repositories/translation_repository_spec.rb
locomotivecms_steam-1.1.1 spec/integration/repositories/translation_repository_spec.rb
locomotivecms_steam-1.1.0 spec/integration/repositories/translation_repository_spec.rb
locomotivecms_steam-1.1.0.rc3 spec/integration/repositories/translation_repository_spec.rb
locomotivecms_steam-1.1.0.rc2 spec/integration/repositories/translation_repository_spec.rb
locomotivecms_steam-1.1.0.rc1 spec/integration/repositories/translation_repository_spec.rb
locomotivecms_steam-1.0.1 spec/integration/repositories/translation_repository_spec.rb
locomotivecms_steam-1.0.0 spec/integration/repositories/translation_repository_spec.rb
locomotivecms_steam-1.0.0.rc10 spec/integration/repositories/translation_repository_spec.rb
locomotivecms_steam-1.0.0.rc9 spec/integration/repositories/translation_repository_spec.rb
locomotivecms_steam-1.0.0.rc8 spec/integration/repositories/translation_repository_spec.rb
locomotivecms_steam-1.0.0.rc6 spec/integration/repositories/translation_repository_spec.rb
locomotivecms_steam-1.0.0.rc4 spec/integration/repositories/translation_repository_spec.rb
locomotivecms_steam-1.0.0.rc3 spec/integration/repositories/translation_repository_spec.rb