Sha256: a5ff6fce4efd623dfc621ca80721cb2900ec158d985a39cfd5413f303b0c8562

Contents?: true

Size: 1.51 KB

Versions: 24

Compression:

Stored size: 1.51 KB

Contents

require 'spec_helper'

describe "Translation integration" do

  context "in admin backend" do

    before do
      authorize_as_admin
    end

    it "should be possible to set the locale of the admin backend via params" do
      visit admin_dashboard_path(:locale => :de)
      page.should have_content('Willkommen')
    end

    it "should store the current locale in the session" do
      visit admin_dashboard_path(:locale => :de)
      visit admin_dashboard_path
      page.should have_content('Willkommen')
    end

    it "should be possible to change the current locale in the session" do
      visit admin_dashboard_path(:locale => :de)
      page.should have_content('Willkommen')
      visit admin_dashboard_path(:locale => :en)
      page.should have_content('Welcome')
    end

    it "should not be possible to switch the locale of the admin backend to an unknown locale" do
      visit admin_dashboard_path(:locale => :ko)
      page.should have_content('Welcome')
    end

    context "if no other parameter is given" do
      it "should use the current users language setting" do
        Alchemy::User.first.update_attributes!(language: 'de')
        visit admin_dashboard_path
        page.should have_content('Willkommen')
      end
    end

  end

  context "with translated header" do

    before do
      Capybara.current_driver = :rack_test_translated_header
    end

    it "should use the browsers language setting if no other parameter is given" do
      visit root_path
      ::I18n.locale.should == :de
    end

  end

end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
alchemy_cms-2.8.3 spec/features/translation_integration_spec.rb
alchemy_cms-2.7.5 spec/features/translation_integration_spec.rb
alchemy_cms-2.6.3 spec/features/translation_integration_spec.rb
alchemy_cms-2.7.4 spec/features/translation_integration_spec.rb
alchemy_cms-2.8.2 spec/features/translation_integration_spec.rb
alchemy_cms-2.8.1 spec/features/translation_integration_spec.rb
alchemy_cms-2.7.3 spec/features/translation_integration_spec.rb
alchemy_cms-2.7.2 spec/features/translation_integration_spec.rb
alchemy_cms-2.7.1 spec/features/translation_integration_spec.rb
alchemy_cms-2.7.0 spec/features/translation_integration_spec.rb
alchemy_cms-2.6.2.1 spec/features/translation_integration_spec.rb
alchemy_cms-2.6.2 spec/features/translation_integration_spec.rb
alchemy_cms-2.6.1 spec/features/translation_integration_spec.rb
alchemy_cms-2.6.0 spec/features/translation_integration_spec.rb
alchemy_cms-2.6.0.rc5 spec/features/translation_integration_spec.rb
alchemy_cms-2.5.3.1 spec/integration/translation_integration_spec.rb
alchemy_cms-2.5.3 spec/integration/translation_integration_spec.rb
alchemy_cms-2.5.2.2 spec/integration/translation_integration_spec.rb
alchemy_cms-2.5.2.1 spec/integration/translation_integration_spec.rb
alchemy_cms-2.5.2 spec/integration/translation_integration_spec.rb