Sha256: 3f74db5460b747fe22b409de849c17a7b209b7c3a661bb7c8c2d3f9b8d05154a

Contents?: true

Size: 1.52 KB

Versions: 9

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('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')
      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

    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
        page.should have_content('Willkommen')
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
alchemy_cms-3.0.4 spec/features/translation_integration_spec.rb
alchemy_cms-3.0.3 spec/features/translation_integration_spec.rb
alchemy_cms-3.0.2 spec/features/translation_integration_spec.rb
alchemy_cms-3.0.1 spec/features/translation_integration_spec.rb
alchemy_cms-3.0.0 spec/features/translation_integration_spec.rb
alchemy_cms-3.0.0.rc8 spec/features/translation_integration_spec.rb
alchemy_cms-3.0.0.rc7 spec/features/translation_integration_spec.rb
alchemy_cms-3.0.0.rc6 spec/features/translation_integration_spec.rb
alchemy_cms-3.0.0.rc5 spec/features/translation_integration_spec.rb