Add validation to check translations amount on updates
In order to not allow users to remove all persited translations from any resource. A few exceptions were added: * Does not apply to globalizable models without translatable attributes required * Make a copy of main model error on current translations to be more realistic
This commit is contained in:
@@ -236,6 +236,19 @@ shared_examples "edit_translatable" do |factory_name, path_name, input_fields, t
|
||||
expect_not_to_have_language "Español"
|
||||
end
|
||||
|
||||
scenario "Remove all translations should show an error message", :js do
|
||||
skip("can't have invalid translations") if required_fields.empty?
|
||||
|
||||
visit path
|
||||
|
||||
click_link "Remove language"
|
||||
click_link "Remove language"
|
||||
|
||||
click_button update_button_text
|
||||
|
||||
expect(page).to have_content "Is mandatory to provide one translation at least"
|
||||
end
|
||||
|
||||
scenario "Remove a translation with invalid data", :js do
|
||||
skip("can't have invalid translations") if required_fields.empty?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user