Allow locale to be set through the front-end
* Store the last used locale in the session * Allow home page to be identified in helpers even when containing parameters * Create initializer to explicitly set the available locales, the default and the load_path
This commit is contained in:
27
spec/features/localization_spec.rb
Normal file
27
spec/features/localization_spec.rb
Normal file
@@ -0,0 +1,27 @@
|
||||
require 'rails_helper'
|
||||
|
||||
feature 'Localization' do
|
||||
|
||||
scenario 'Wrong locale' do
|
||||
visit root_path(locale: :es)
|
||||
visit root_path(locale: :klingon)
|
||||
|
||||
expect(page).to have_text('Estamos abriendo Madrid')
|
||||
end
|
||||
|
||||
scenario 'Changing locale' do
|
||||
visit root_path(locale: :es)
|
||||
locale_switcher = find('#locale-switcher')
|
||||
|
||||
expect(page).to have_text('Estamos abriendo Madrid')
|
||||
expect(locale_switcher).to have_text('en')
|
||||
expect(locale_switcher).to_not have_text('es')
|
||||
|
||||
find('#locale-link-en').click
|
||||
locale_switcher = find('#locale-switcher')
|
||||
|
||||
expect(page).to have_text('We are opening Madrid')
|
||||
expect(locale_switcher).to have_text('es')
|
||||
expect(locale_switcher).to_not have_text('en')
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user