Sha256: 2b112a2ea5104e53e45d8fdad466c4d9b4caa7d19758a884bf0c95b1ce040f5c

Contents?: true

Size: 1.52 KB

Versions: 2

Compression:

Stored size: 1.52 KB

Contents

require 'spec_helper'

describe "Translation integration" do
  context "in admin backend" do
    before { authorize_as_admin(mock_model('User', alchemy_roles: %w(admin), role_symbols: [:admin], language: 'de', name: 'Peter')) }

    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

    context 'with unknown locale' do
      it "it uses the users default language" do
        visit admin_dashboard_path(locale: 'ko')
        page.should have_content('Willkommen')
      end
    end

    context "if no other parameter is given" do
      it "should use the current users language setting" do
        visit admin_dashboard_path
        page.should have_content('Willkommen')
      end
    end
  end

  context "with translated header" do
    before { Capybara.current_driver = :rack_test_translated_header }

    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

2 entries across 2 versions & 1 rubygems

Version Path
alchemy_cms-2.9.1 spec/features/translation_integration_spec.rb
alchemy_cms-2.9.0 spec/features/translation_integration_spec.rb