Sha256: 078a0cf23ffa81a7a0eb870c1faad1eb98cb7f37e2761895a1374b6d5c47df25

Contents?: true

Size: 996 Bytes

Versions: 18

Compression:

Stored size: 996 Bytes

Contents

require 'spec_helper'

module Alchemy
  describe I18n do
    describe '.translation_files' do
      subject { I18n.translation_files }
      it      { is_expected.to be_a Array }
      it      { is_expected.to be_any { |f| f =~ /alchemy.*.yml/ } }
    end

    describe '.available_locales' do
      subject { I18n.available_locales }
      before  { allow(I18n).to receive(:translation_files).and_return(['alchemy.kl.yml']) }
      it      { is_expected.to be_a Array }
      it      { is_expected.to include :kl }

      context 'when locales are already set in @@available_locales' do
        before { I18n.class_variable_set(:@@available_locales, [:kl, :jp]) }
        it     { is_expected.to eq([:kl, :jp]) }
      end
    end

    describe '.available_locales=' do
      it "assigns the given locales to @@available_locales" do
        I18n.available_locales = [:kl, :nl, :cn]
        expect(I18n.class_variable_get(:@@available_locales)).to eq([:kl, :nl, :cn])
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
alchemy_cms-3.2.1 spec/libraries/i18n_spec.rb
alchemy_cms-3.1.3 spec/libraries/i18n_spec.rb
lc_alchemy_cms-3.2.1 spec/libraries/i18n_spec.rb
lc_alchemy_cms-3.2.0 spec/libraries/i18n_spec.rb
alchemy_cms-3.2.0 spec/libraries/i18n_spec.rb
alchemy_cms-3.2.0.rc1 spec/libraries/i18n_spec.rb
alchemy_cms-3.2.0.beta spec/libraries/i18n_spec.rb
alchemy_cms-3.1.1 spec/libraries/i18n_spec.rb
alchemy_cms-3.1.0 spec/libraries/i18n_spec.rb
alchemy_cms-3.1.0.rc3 spec/libraries/i18n_spec.rb
alchemy_cms-3.1.0.rc2 spec/libraries/i18n_spec.rb
alchemy_cms-3.1.0.rc1 spec/libraries/i18n_spec.rb
alchemy_cms-3.1.0.beta6 spec/libraries/i18n_spec.rb
alchemy_cms-3.1.0.beta5 spec/libraries/i18n_spec.rb
alchemy_cms-3.1.0.beta4 spec/libraries/i18n_spec.rb
alchemy_cms-3.1.0.beta3 spec/libraries/i18n_spec.rb
alchemy_cms-3.1.0.beta2 spec/libraries/i18n_spec.rb
alchemy_cms-3.1.0.beta1 spec/libraries/i18n_spec.rb