mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Revert "Change products controller to clear variants unit description if variant_unit is items"
This reverts commit 1a4e83d633.
This commit is contained in:
@@ -44,8 +44,6 @@ Spree::Admin::ProductsController.class_eval do
|
||||
delete_stock_params_and_set_after do
|
||||
super
|
||||
end
|
||||
|
||||
clear_variants_unit_description if @object.variant_unit == 'items'
|
||||
end
|
||||
|
||||
def bulk_update
|
||||
@@ -190,10 +188,4 @@ Spree::Admin::ProductsController.class_eval do
|
||||
def set_product_master_variant_price_to_zero
|
||||
@product.price = 0 if @product.price.nil?
|
||||
end
|
||||
|
||||
def clear_variants_unit_description
|
||||
@object.variants.each do |variant|
|
||||
variant.update_attribute :unit_description, ''
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -194,19 +194,6 @@ describe Spree::Admin::ProductsController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
describe "product variant unit is items" do
|
||||
it "clears unit description of all variants of the product" do
|
||||
product.variants.first.update_attribute :unit_description, "grams"
|
||||
spree_put :update,
|
||||
id: product,
|
||||
product: {
|
||||
variant_unit: "items",
|
||||
variant_unit_name: "bag"
|
||||
}
|
||||
expect(product.reload.variants.first.unit_description).to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
describe "product properties" do
|
||||
context "as an enterprise user" do
|
||||
let!(:property) { create(:property, name: "A nice name") }
|
||||
|
||||
Reference in New Issue
Block a user