Sha256: d18b21f869270e72fc84ad78793f23cb6906176ce6d80c35d8f0d7e72d957eee

Contents?: true

Size: 1.54 KB

Versions: 7

Compression:

Stored size: 1.54 KB

Contents

require 'spec_helper'

describe "Translation integration" do
  context "in admin backend" do
    before { authorize_as_admin(mock_model('DummyUser', alchemy_roles: %w(admin), language: 'de')) }

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

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

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

    context 'with unknown locale' do
      it "it uses the users default language" do
        visit admin_dashboard_path(locale: 'ko')
        expect(page).to 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
        expect(page).to have_content('Willkommen')
      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 admin_dashboard_path
        expect(page).to have_content('Willkommen')
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
alchemy_cms-3.1.0.rc1 spec/features/translation_integration_spec.rb
alchemy_cms-3.1.0.beta6 spec/features/translation_integration_spec.rb
alchemy_cms-3.1.0.beta5 spec/features/translation_integration_spec.rb
alchemy_cms-3.1.0.beta4 spec/features/translation_integration_spec.rb
alchemy_cms-3.1.0.beta3 spec/features/translation_integration_spec.rb
alchemy_cms-3.1.0.beta2 spec/features/translation_integration_spec.rb
alchemy_cms-3.1.0.beta1 spec/features/translation_integration_spec.rb