Sha256: c9c02ec6f2c58cca6165d6363d6205d50d356ce59bacb24be57cb34917bf3990

Contents?: true

Size: 965 Bytes

Versions: 3

Compression:

Stored size: 965 Bytes

Contents

require 'spec_helper'

feature 'Locales' do
  include SessionSteps

  before do
    @user = create(:user_with_account)
    login(@user)
  end

  scenario "providing the :locale parameter to display the page in different languages" do

    locale_before_scenario = I18n.locale

    # providing the url parameter should change the locale.
    #
    visit user_path(@user, :locale => :de)
    page.should have_text "Mein Profil"
    visit user_path(@user, :locale => :en)
    page.should have_text "My Profile"

    # the locale should be kept when visiting another page (using a cookie).
    #
    visit root_path
    page.should have_text "My Profile"
    page.should have_no_text "Mein Profil"

    # reset the locale to the one before the spec.
    # Since the locale is stored in a cookie, otherwise, the
    # following specs can be affected.
    #
    visit user_path(@user, :locale => locale_before_scenario)
    page.should have_text "Mein Profil"
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
your_platform-1.0.1 spec/features/locales_spec.rb
your_platform-1.0.0 spec/features/locales_spec.rb
your_platform-0.0.2 spec/features/locales_spec.rb