From d2dd5f2a581f67b4d5014889f98bc43be786b290 Mon Sep 17 00:00:00 2001 From: Marko Lovic Date: Tue, 28 Aug 2018 11:08:03 +0200 Subject: [PATCH] Test Translatable logic with a locale with non-underscored name In the past there have been issues with the `pt-BR` locale because it has a hyphen `-` and a uppercase letters. I am adding the test only to spec/features/translations_spec.rb (which tests Milestones) for now. We might want to also add it to the other translatable resource specs in the future (banners, etc.). --- spec/features/translations_spec.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/spec/features/translations_spec.rb b/spec/features/translations_spec.rb index 7077a9a4b..95ec3dd53 100644 --- a/spec/features/translations_spec.rb +++ b/spec/features/translations_spec.rb @@ -83,6 +83,26 @@ feature "Translations" do expect(page).not_to have_content "Description in English" end + scenario "Add a translation for a locale with non-underscored name", :js do + visit @edit_milestone_url + + select "Português", from: "translation_locale" + fill_in 'budget_investment_milestone_description_pt_br', with: 'Description in pt-BR' + + click_button 'Update milestone' + expect(page).to have_content "Milestone updated successfully" + + visit budget_investment_path(investment.budget, investment) + + click_link("Milestones (1)") + expect(page).to have_content("Description in English") + + select('Português', from: 'locale-switcher') + click_link("Seguimiento (1)") + + expect(page).to have_content('Description in pt-BR') + end + context "Globalize javascript interface" do scenario "Highlight current locale", :js do