25 lines
1.0 KiB
Diff
25 lines
1.0 KiB
Diff
From 0212a6e2f15214c34ea6015ea9a2718fcc24ee66 Mon Sep 17 00:00:00 2001
|
|
From: Josh Nichols <josh.nichols@gusto.com>
|
|
Date: Tue, 25 Jan 2022 11:16:07 -0500
|
|
Subject: [PATCH] Only mark classes as unloadable when Rails supports it
|
|
|
|
Rails 7.0 drops "classic" mode in favor of zeitwerk. The unloadable
|
|
method is no longer available.
|
|
---
|
|
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 c7e294b86..f73fe2e3a 100644
|
|
--- a/spec/support/unit/helpers/class_builder.rb
|
|
+++ b/spec/support/unit/helpers/class_builder.rb
|
|
@@ -55,7 +55,7 @@ class #{namespace}::#{name_without_namespace} < ::#{parent_class}
|
|
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
|