Sha256: facec74e72ce4432c9cd4435151a14204c58c78eb9f6ff11846f8bd8e5d007d8

Contents?: true

Size: 1.51 KB

Versions: 4

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

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

  end

  context "with translated header" do

    before do
      # Hack my hack.... OMG
      Rails.stub(:env).and_return('foo')
      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

4 entries across 4 versions & 1 rubygems

Version Path
alchemy_cms-2.3.1 spec/integration/translation_integration_spec.rb
alchemy_cms-2.4.beta2 spec/integration/translation_integration_spec.rb
alchemy_cms-2.3.0 spec/integration/translation_integration_spec.rb
alchemy_cms-2.3.rc5 spec/integration/translation_integration_spec.rb