Files
openfoodnetwork/spec/system/admin/multilingual_spec.rb
David Rodríguez 4c6d894bc0 Bump RuboCop to 1.86.6
There were a few changes needed:

* Plugins are now specified through `plugin:` config keyword.
* All plugin gems need to be specified explicitly in Gemfile since they
  are no longer dependencies of plugins already specified explicitly.
* All plugin gems need to be updated in other to use the new APIs.
* One cop was renamed.
* New offenses safe to correct were corrected directly with `bundle exec
  rubocop -a`.
* New offenses unsafe to correct were added to the TODO configuration
  with `bundle exec rubocop --auto-gen-config --auto-gen-only-exclude
  --exclude-limit 1400 --no-auto-gen-timestamp`.
2025-10-27 11:30:33 +01:00

45 lines
1.4 KiB
Ruby

# frozen_string_literal: true
require 'system_helper'
RSpec.describe 'Multilingual' do
include AuthenticationHelper
include WebHelper
let(:admin_user) { create(:admin_user) }
before do
login_as admin_user
visit spree.admin_dashboard_path
end
it 'has three locales available' do
expect(Rails.application.config.i18n[:default_locale]).to eq 'en'
expect(Rails.application.config.i18n[:locale]).to eq 'en'
expect(Rails.application.config.i18n[:available_locales]).to eq ['en', 'es', 'pt']
end
it 'can switch language by params' do
expect(pick_i18n_locale).to eq 'en'
expect(get_i18n_translation('spree_admin_overview_enterprises_header')).to eq 'My Enterprises'
expect(page).to have_content 'My Enterprises'
expect(admin_user.locale).to be_nil
visit spree.admin_dashboard_path(locale: 'es')
expect(pick_i18n_locale).to eq 'es'
expect(get_i18n_translation('spree_admin_overview_enterprises_header'))
.to eq 'Mis Organizaciones'
expect(page).to have_content 'Mis Organizaciones'
admin_user.reload
expect(admin_user.locale).to eq 'es'
end
it 'fallbacks to default_locale' do
visit spree.admin_dashboard_path(locale: 'it')
expect(pick_i18n_locale).to eq 'en'
expect(get_i18n_translation('spree_admin_overview_enterprises_header')).to eq 'My Enterprises'
expect(page).to have_content 'My Enterprises'
expect(admin_user.locale).to be_nil
end
end