Ensure ShippingMethod#destroy is using soft-deletion

25f5c2daf8

We've already applied some of the changes in this commit during previous Spree upgrade work, but there were a couple of bits missing.
This commit is contained in:
Matt-Yorkley
2020-12-08 14:27:05 +00:00
parent 3877721209
commit 46ff247bc9
2 changed files with 11 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ module Spree
include Spree::Core::CalculatedAdjustments
DISPLAY = [:both, :front_end, :back_end].freeze
acts_as_paranoid
acts_as_taggable
default_scope -> { where(deleted_at: nil) }

View File

@@ -159,6 +159,16 @@ module Spree
end
end
# Regression test for Spree #4320
context "soft deletion" do
let(:shipping_method) { create(:shipping_method) }
it "soft-deletes when destroy is called" do
shipping_method.destroy
expect(shipping_method.deleted_at).to_not be_blank
end
end
context 'factory' do
let(:shipping_method){ create :shipping_method }