Merge pull request #3394 from mkllnk/3021-update-soft-delete

[Spree upgrade] 3021 update soft delete
This commit is contained in:
Pau Pérez Fabregat
2019-02-25 11:58:41 +01:00
committed by GitHub
18 changed files with 67 additions and 85 deletions

View File

@@ -69,6 +69,16 @@ module Spree
lambda { variant.reload }.should_not raise_error
variant.deleted_at.should_not be_nil
end
it "doesn't delete the only variant of the product" do
product = create(:product)
variant = product.variants.first
spree_delete :soft_delete, {variant_id: variant.to_param, product_id: product.to_param, format: :json}
expect(variant.reload).to_not be_deleted
expect(assigns(:variant).errors[:product]).to include "must have at least one variant"
end
end
end
end