diff --git a/spec/support/macros/deprecation.rb b/spec/support/macros/deprecation.rb
index <HASH>..<HASH> 100644
--- a/spec/support/macros/deprecation.rb
+++ b/spec/support/macros/deprecation.rb
@@ -1,18 +1,9 @@
 require "active_support"
 
-module SilenceDeprecation
-  def silence_deprecation(example)
-    cached_silenced = FactoryBot::Deprecation.silenced
-    FactoryBot::Deprecation.silenced = true
-    example.run
-    FactoryBot::Deprecation.silenced = cached_silenced
-  end
-end
-
 RSpec.configure do |config|
-  config.include SilenceDeprecation
-
   config.around :example, silence_deprecation: true do |example|
-    silence_deprecation(example)
+    with_temporary_assignment(FactoryBot::Deprecation, :silenced, true) do
+      example.run
+    end
   end
 end
Use temporary assignment helper to silence deprecations in specs