Sha256: d70396994dd76fb6f7f020b19e67eac9d60589c771cd079880f884b0ef7296da

Contents?: true

Size: 746 Bytes

Versions: 22

Compression:

Stored size: 746 Bytes

Contents

require 'spec_helper'

module Alchemy
  describe BaseController do

    describe '#set_locale' do
      context 'with Language.current set' do
        let(:language) { create(:klingonian) }

        before { Alchemy::Language.current = language }

        it "sets the ::I18n.locale to current language code" do
          controller.send(:set_locale)
          expect(::I18n.locale).to eq(language.code.to_sym)
        end
      end

      context 'without Language.current set' do
        before { Alchemy::Language.current = nil }

        it "sets the ::I18n.locale to default language code" do
          controller.send(:set_locale)
          expect(::I18n.locale).to eq(Language.default.code.to_sym)
        end
      end
    end

  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
alchemy_cms-3.1.3 spec/controllers/base_controller_spec.rb
alchemy_cms-3.2.0.beta spec/controllers/base_controller_spec.rb
alchemy_cms-3.1.1 spec/controllers/base_controller_spec.rb
alchemy_cms-3.0.4 spec/controllers/base_controller_spec.rb
alchemy_cms-3.1.0 spec/controllers/base_controller_spec.rb
alchemy_cms-3.1.0.rc3 spec/controllers/base_controller_spec.rb
alchemy_cms-3.1.0.rc2 spec/controllers/base_controller_spec.rb
alchemy_cms-3.1.0.rc1 spec/controllers/base_controller_spec.rb
alchemy_cms-3.1.0.beta6 spec/controllers/base_controller_spec.rb
alchemy_cms-3.1.0.beta5 spec/controllers/base_controller_spec.rb
alchemy_cms-3.1.0.beta4 spec/controllers/base_controller_spec.rb
alchemy_cms-3.0.3 spec/controllers/base_controller_spec.rb
alchemy_cms-3.1.0.beta3 spec/controllers/base_controller_spec.rb
alchemy_cms-3.1.0.beta2 spec/controllers/base_controller_spec.rb
alchemy_cms-3.1.0.beta1 spec/controllers/base_controller_spec.rb
alchemy_cms-3.0.2 spec/controllers/base_controller_spec.rb
alchemy_cms-3.0.1 spec/controllers/base_controller_spec.rb
alchemy_cms-3.0.0 spec/controllers/base_controller_spec.rb
alchemy_cms-3.0.0.rc8 spec/controllers/base_controller_spec.rb
alchemy_cms-3.0.0.rc7 spec/controllers/base_controller_spec.rb