Fix specs active_polls_spec.rb:10

This commit is contained in:
taitus
2019-03-22 15:15:40 +01:00
committed by voodoorai2000
parent b86579c40f
commit 2964d91303

View File

@@ -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