From fdada89756f4e7bf5d9f54a7b38140348cecc9ca Mon Sep 17 00:00:00 2001 From: Chris de Bruin Date: Tue, 19 Dec 2023 13:49:44 +0100 Subject: [PATCH] Only lazy load in test --- lib/route_translator/translator/route_helpers.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/route_translator/translator/route_helpers.rb b/lib/route_translator/translator/route_helpers.rb index b8935173..71f49d48 100644 --- a/lib/route_translator/translator/route_helpers.rb +++ b/lib/route_translator/translator/route_helpers.rb @@ -27,9 +27,11 @@ def add(old_name, named_route_collection) __send__(Translator.route_name_for(args, old_name, suffix, self), *args) end - TEST_CASE_HOOKS.each do |test_case_hook| - ActiveSupport.on_load(test_case_hook) do - include helper_container + if ENV.fetch('RAILS_ENV', nil) == 'test' + TEST_CASE_HOOKS.each do |test_case_hook| + ActiveSupport.on_load(test_case_hook) do + include helper_container + end end end end