Sha256: ad7139f73356fcab84d1b18a0d553f83ec7755e962875d22aca2db56a9604303

Contents?: true

Size: 986 Bytes

Versions: 54

Compression:

Stored size: 986 Bytes

Contents

require 'spec_helper'

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

describe Locomotive::Steam::TranslationRepository do

  let(:translations)  { [{ key: 'powered_by', values: { 'en' => 'Powered by Steam', 'fr' => 'Propulsé par Steam' } }] }
  let(:locale)        { :en }
  let(:site)          { instance_double('Site', _id: 1, default_locale: :en, locales: [:en, :fr]) }
  let(:adapter)       { Locomotive::Steam::FilesystemAdapter.new(nil) }
  let(:repository)    { described_class.new(adapter, site, locale) }

  before do
    allow(adapter).to receive(:collection).and_return(translations)
    adapter.cache = NoCacheStore.new
  end

  describe '#by_key' do

    let(:key) { nil }
    subject { repository.by_key(key) }

    it { is_expected.to eq nil }

    context 'existing translation' do

      let(:key) { 'powered_by' }
      it { expect(subject.values).to eq({ 'en' => 'Powered by Steam', 'fr' => 'Propulsé par Steam' }) }

    end

  end

end

Version data entries

54 entries across 54 versions & 1 rubygems

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