Add translation for product cloned message

A validation error shouldn't happen. If it does, it's an exception, not an error.
This commit is contained in:
David Cook
2023-12-06 15:07:37 +11:00
parent 0f46da07b2
commit 0f3a952fd0
3 changed files with 6 additions and 7 deletions

View File

@@ -82,13 +82,9 @@ module Spree
def clone
@new = @product.duplicate
raise "Clone failed" unless @new.save
flash[:success] = if @new.save
Spree.t('notice_messages.product_cloned')
else
Spree.t('notice_messages.product_not_cloned')
end
flash[:success] = t('.success')
redirect_to spree.admin_products_url
end

View File

@@ -4348,6 +4348,8 @@ See the %{link} to find out more about %{sitename}'s features and to start using
bulk_unit_size: Bulk unit size
display_as:
display_as: Display As
clone:
success: Product cloned
reports:
table:
select_and_search: "Select filters and click on %{option} to access your data."

View File

@@ -237,7 +237,6 @@ describe 'As an admin, I can see the new product page', feature: :admin_style_v3
expect(page).to have_css "button[aria-label='On Hand']", text: "6"
end
pending
expect(page).to have_content "Changes saved"
end
@@ -398,6 +397,8 @@ describe 'As an admin, I can see the new product page', feature: :admin_style_v3
click_link('Clone')
end
expect(page).to have_content "Product cloned"
within "table.products" do
# Gather input values, because page.content doesn't include them.
input_content = page.find_all('input[type=text]').map(&:value).join