From 9c74fa393d414792d3f8e700603ab3dfb16d5ee3 Mon Sep 17 00:00:00 2001 From: Angel Perez Date: Thu, 26 Jul 2018 17:48:23 -0400 Subject: [PATCH] Translations can be removed --- .../information_texts_spec.rb | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/spec/features/admin/site_customization/information_texts_spec.rb b/spec/features/admin/site_customization/information_texts_spec.rb index 1e453fe00..ba0a3f9cc 100644 --- a/spec/features/admin/site_customization/information_texts_spec.rb +++ b/spec/features/admin/site_customization/information_texts_spec.rb @@ -152,16 +152,35 @@ feature "Admin custom information texts" do end scenario "Remove a translation", :js do - visit @edit_milestone_url + first_key = "debates.form.debate_title" + debate_title = create(:i18n_content, key: first_key, + value_en: 'Custom debate title', + value_es: 'Título personalizado de debate') + + second_key = "debates.form.debate_text" + debate_text = create(:i18n_content, key: second_key, + value_en: 'Custom debate text', + value_es: 'Texto personalizado de debate') + + visit admin_site_customization_information_texts_path click_link "Español" click_link "Remove language" + click_button "Save" expect(page).not_to have_link "Español" - click_button "Update milestone" - visit @edit_milestone_url - expect(page).not_to have_link "Español" + click_link 'English' + expect(page).to have_content 'Custom debate text' + expect(page).to have_content 'Custom debate title' + + debate_title.reload + debate_text.reload + + expect(debate_text.value_es).to be(nil) + expect(debate_title.value_es).to be(nil) + expect(debate_text.value_en).to eq('Custom debate text') + expect(debate_title.value_en).to eq('Custom debate title') end context "Globalize javascript interface" do