diff --git a/spec/shared/features/translatable.rb b/spec/shared/features/translatable.rb index 4f4458a78..05c914864 100644 --- a/spec/shared/features/translatable.rb +++ b/spec/shared/features/translatable.rb @@ -57,6 +57,9 @@ shared_examples "translatable" do |factory_name, path_name, input_fields, textar end scenario "should show first available fallback when current locale translation does not exist", :js do + if translatable_class.name == "ActivePoll" + skip("Skip because after updating it doesn't render the description") + end attributes = fields.product(%i[fr]).map do |field, locale| [:"#{field}_#{locale}", text_for(field, locale)] end.to_h @@ -72,6 +75,26 @@ shared_examples "translatable" do |factory_name, path_name, input_fields, textar expect(page).to have_content "en Français" end + scenario "should show first available fallback when current locale translation does not exist for active polls", :js do + if translatable_class.name != "ActivePoll" + skip("Skip because force visit polls_path after update") + end + attributes = fields.product(%i[fr]).map do |field, locale| + [:"#{field}_#{locale}", text_for(field, locale)] + end.to_h + translatable.update(attributes) + visit path + + select "English", from: :translation_locale + click_link "Remove language" + select "Español", from: :translation_locale + click_link "Remove language" + click_button update_button_text + visit polls_path + + expect(page).to have_content "en Français" + end + scenario "Add a translation", :js do visit path