Skip to content

Commit 08a2e8e

Browse files
committed
Fix render_options_spec tests for immediate_hydration
Updates render_options_spec.rb to handle immediate_hydration correctly: - Removes immediate_hydration from configurable_options list since it's no longer a ReactOnRails configuration option - Adds dedicated tests for immediate_hydration that verify: - Explicit true/false values work - Default behavior uses ProUtils.immediate_hydration_enabled? This fixes test failures caused by trying to set immediate_hydration on ReactOnRails.configuration which no longer exists.
1 parent 7305cc7 commit 08a2e8e

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

spec/react_on_rails/react_component/render_options_spec.rb

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
replay_console
1010
raise_on_prerender_error
1111
random_dom_id
12-
immediate_hydration
1312
].freeze
1413

1514
def the_attrs(react_component_name: "App", options: {})
@@ -164,4 +163,39 @@ def the_attrs(react_component_name: "App", options: {})
164163
end
165164
end
166165
end
166+
167+
describe "#immediate_hydration" do
168+
context "with immediate_hydration option set to true" do
169+
it "returns true" do
170+
options = { immediate_hydration: true }
171+
attrs = the_attrs(options: options)
172+
173+
opts = described_class.new(**attrs)
174+
175+
expect(opts.immediate_hydration).to be true
176+
end
177+
end
178+
179+
context "with immediate_hydration option set to false" do
180+
it "returns false" do
181+
options = { immediate_hydration: false }
182+
attrs = the_attrs(options: options)
183+
184+
opts = described_class.new(**attrs)
185+
186+
expect(opts.immediate_hydration).to be false
187+
end
188+
end
189+
190+
context "without immediate_hydration option" do
191+
it "returns value from ProUtils.immediate_hydration_enabled?" do
192+
allow(ReactOnRails::ProUtils).to receive(:immediate_hydration_enabled?).and_return(true)
193+
attrs = the_attrs
194+
195+
opts = described_class.new(**attrs)
196+
197+
expect(opts.immediate_hydration).to be true
198+
end
199+
end
200+
end
167201
end

0 commit comments

Comments
 (0)