Skip to content

Commit

Permalink
Fix spec/features/locales_spec.rb tests (1/2)
Browse files Browse the repository at this point in the history
Copy/paste same file from DMP Roadmap
  • Loading branch information
aaronskiba committed Jun 17, 2024
1 parent dfa5220 commit da3a9ed
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions spec/features/locales_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@
[
Language.where(
default_language: true,
name: 'English (CA)',
abbreviation: 'en-CA'
name: 'English',
abbreviation: 'en-GB'
).first_or_create,

Language.where(
default_language: false,
name: 'English (GB)',
abbreviation: 'en-GB'
name: 'German',
abbreviation: 'de'
).first_or_create,

Language.where(
default_language: false,
name: 'Français (CA)',
abbreviation: 'fr-CA'
name: 'Portugese',
abbreviation: 'pt-BR'
).first_or_create

]
Expand All @@ -34,7 +34,7 @@
let!(:user) { create(:user, language: languages.first) }

before do
locales = %w[en-GB en-CA fr-CA]
locales = %w[en-GB de pt-BR]
I18n.available_locales = locales
I18n.locale = locales.first
sign_in(user)
Expand All @@ -49,8 +49,10 @@

context 'when new locale has no region' do
scenario 'user changes their locale' do
skip 'We are now expecting locales to have region'
create_plan_text = 'Créer des plans'
create_plan_text = I18n.with_locale(:de) do
_('Create plan')
end

click_link 'Language'
expect(current_path).to eql(plans_path)
expect(page).not_to have_text(create_plan_text)
Expand All @@ -63,12 +65,14 @@

context 'when new locale has region' do
scenario 'user changes their locale' do
create_plan_text = 'Créer des plans'
create_plan_text = I18n.with_locale('pt-BR') do
_('Create plan')
end
click_link 'Language'
expect(current_path).to eql(plans_path)
expect(page).not_to have_text(create_plan_text)

click_link 'Français (CA)'
click_link 'Portugese'
expect(current_path).to eql(plans_path)
expect(page).to have_text(create_plan_text)
end
Expand Down

0 comments on commit da3a9ed

Please sign in to comment.