Fix specs

This commit is contained in:
Ahmed Ejaz
2025-07-27 07:58:04 +05:00
parent 3f39d94bd3
commit df4cf4b768
4 changed files with 18 additions and 301 deletions

View File

@@ -72,8 +72,25 @@ module Spree
render json: @variants, each_serializer: ::Api::Admin::VariantSerializer
end
def destroy
@url_filters = ::ProductFilters.new.extract(request.query_parameters)
@variant = Spree::Variant.find(params[:id])
flash[:success] = delete_variant
redirect_to spree.admin_product_variants_url(params[:product_id], @url_filters)
end
protected
def delete_variant
if VariantDeleter.new.delete(@variant)
Spree.t('notice_messages.variant_deleted')
else
Spree.t('notice_messages.variant_not_deleted')
end
end
def create_before
@object.save
end