Skip to content

Commit 9375aeb

Browse files
committed
Update tests and doctor to use new immediate_hydration behavior
- Removes immediate_hydration check from doctor.rb config analysis - Updates tests to stub ReactOnRails::ProUtils.immediate_hydration_enabled? instead of setting config.immediate_hydration - Removes invalid config.immediate_hydration from dummy app initializer Tests now properly verify that Pro users get immediate hydration and non-Pro users don't, without requiring explicit configuration.
1 parent f4eaf69 commit 9375aeb

File tree

4 files changed

+4
-21
lines changed

4 files changed

+4
-21
lines changed

lib/react_on_rails/doctor.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -732,12 +732,6 @@ def analyze_performance_config(content)
732732
auto_load_match = content.match(/config\.auto_load_bundle\s*=\s*([^\s\n,]+)/)
733733
checker.add_info(" auto_load_bundle: #{auto_load_match[1]}") if auto_load_match
734734

735-
# Immediate hydration (Pro feature)
736-
immediate_hydration_match = content.match(/config\.immediate_hydration\s*=\s*([^\s\n,]+)/)
737-
if immediate_hydration_match
738-
checker.add_info(" immediate_hydration: #{immediate_hydration_match[1]} (React on Rails Pro)")
739-
end
740-
741735
# Component registry timeout
742736
timeout_match = content.match(/config\.component_registry_timeout\s*=\s*([^\s\n,]+)/)
743737
return unless timeout_match

spec/dummy/config/initializers/react_on_rails.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,5 @@ def self.adjust_props_for_client_side_hydration(component_name, props)
4141
config.rendering_props_extension = RenderingPropsExtension
4242
config.components_subdirectory = "startup"
4343
config.auto_load_bundle = true
44-
config.immediate_hydration = false
4544
config.generated_component_packs_loading_strategy = :defer
4645
end

spec/dummy/spec/helpers/react_on_rails_helper_spec.rb

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,8 @@ def self.pro_attribution_comment
3838
stub_const("ReactOnRailsPro", pro_module)
3939
stub_const("ReactOnRailsPro::Utils", utils_module)
4040

41-
# Configure immediate_hydration to true for tests since they expect that behavior
42-
ReactOnRails.configure do |config|
43-
config.immediate_hydration = true
44-
end
45-
end
46-
47-
after do
48-
# Reset to default - avoid validation issues by setting directly
49-
ReactOnRails.configuration.immediate_hydration = false
41+
# Stub immediate_hydration_enabled? to return true for tests since they expect that behavior
42+
allow(ReactOnRails::ProUtils).to receive(:immediate_hydration_enabled?).and_return(true)
5043
end
5144

5245
let(:hash) do

spec/dummy/spec/system/integration_spec.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,9 @@ def self.pro_attribution_comment
104104
end
105105
stub_const("ReactOnRailsPro", pro_module)
106106
stub_const("ReactOnRailsPro::Utils", utils_module)
107-
end
108107

109-
around do |example|
110-
ReactOnRails.configure { |config| config.immediate_hydration = true }
111-
example.run
112-
ReactOnRails.configure { |config| config.immediate_hydration = false }
108+
# Stub immediate_hydration_enabled? to return true for tests since they expect that behavior
109+
allow(ReactOnRails::ProUtils).to receive(:immediate_hydration_enabled?).and_return(true)
113110
end
114111
end
115112

0 commit comments

Comments
 (0)