Blob Blame History Raw
From 4a2702e5a0b18cb86a8bb0d52616a44f1ef70852 Mon Sep 17 00:00:00 2001
From: Josh Nichols <josh.nichols@gusto.com>
Date: Wed, 26 Jan 2022 08:52:44 -0500
Subject: [PATCH] conditionally use unloadable in another spot

---
 spec/support/unit/helpers/class_builder.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/spec/support/unit/helpers/class_builder.rb b/spec/support/unit/helpers/class_builder.rb
index f73fe2e3a..569aca74d 100644
--- a/spec/support/unit/helpers/class_builder.rb
+++ b/spec/support/unit/helpers/class_builder.rb
@@ -34,7 +34,7 @@ module #{namespace}::#{name_without_namespace}
         RUBY
 
         namespace.const_get(name_without_namespace).tap do |constant|
-          constant.unloadable
+          constant.unloadable if constant.respond_to?(:unloadable) # if Rails is in classic mode, mark it unloadable
           @_defined_modules = defined_modules | [constant]
 
           if block