From 244c5c056bfd6f5d0af6cc4abc3a12e3542bc809 Mon Sep 17 00:00:00 2001
From: Jared Norman <jared@super.gd>
Date: Mon, 6 Jun 2022 10:05:09 -0700
Subject: [PATCH] Ensure removal of constants in specs

This ensures that even if the specs fail, they don't leak constants.
---
 core/spec/lib/spree/core/stock_configuration_spec.rb | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/core/spec/lib/spree/core/stock_configuration_spec.rb b/core/spec/lib/spree/core/stock_configuration_spec.rb
index 8d2437752d0..8b082840c1b 100644
--- a/core/spec/lib/spree/core/stock_configuration_spec.rb
+++ b/core/spec/lib/spree/core/stock_configuration_spec.rb
@@ -18,6 +18,7 @@
 
       expect(subject).to be MyCoordinator
 
+    ensure
       Object.send(:remove_const, :MyCoordinator)
     end
   end
@@ -35,6 +36,7 @@
 
       expect(subject).to be MyEstimator
 
+    ensure
       Object.send(:remove_const, :MyEstimator)
     end
   end
@@ -52,6 +54,7 @@
 
       expect(subject).to be MyFilter
 
+    ensure
       Object.send(:remove_const, :MyFilter)
     end
   end
@@ -69,6 +72,7 @@
 
       expect(subject).to be MySorter
 
+    ensure
       Object.send(:remove_const, :MySorter)
     end
   end
@@ -86,6 +90,7 @@
 
       expect(subject).to be MyAllocator
 
+    ensure
       Object.send(:remove_const, :MyAllocator)
     end
   end
@@ -103,6 +108,7 @@
 
       expect(subject).to be MyInventoryUnitBuilder
 
+    ensure
       Object.send(:remove_const, :MyInventoryUnitBuilder)
     end
   end
@@ -122,6 +128,7 @@
 
       expect(subject).to be MyAvailabilityValidator
 
+    ensure
       Object.send(:remove_const, :MyAvailabilityValidator)
     end
   end
@@ -141,6 +148,7 @@
 
       expect(subject).to be MyInventoryValidator
 
+    ensure
       Object.send(:remove_const, :MyInventoryValidator)
     end
   end