Skip to content

Commit 261244b

Browse files
committed
Fix ReactOnRailsPro::Utils constant loading issue
Add guard to check if ReactOnRailsPro::Utils is defined before calling it. Add rescue block to handle NameError and LoadError gracefully. This fixes the issue where tests fail with 'uninitialized constant ReactOnRailsPro::Utils' when the Pro gem is available but not fully loaded yet. Fixes failing test: ReactOnRails::Configuration changes the configuration of the gem
1 parent 604065e commit 261244b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/react_on_rails/utils.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,11 @@ def self.react_on_rails_pro?
261261

262262
# Guard against edge cases where constant exists but module isn't fully loaded
263263
require "react_on_rails_pro" unless defined?(ReactOnRailsPro)
264+
return false unless defined?(ReactOnRailsPro::Utils)
265+
264266
ReactOnRailsPro::Utils.validated_license_data!.present?
267+
rescue NameError, LoadError
268+
false
265269
end
266270
end
267271

0 commit comments

Comments
 (0)