Skip to content

Commit d678ca8

Browse files
Fix: Stub rsc_support_enabled? method in ReactOnRailsPro module for accurate testing
1 parent ec3517d commit d678ca8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

spec/dummy/spec/packs_generator_spec.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,13 @@ def self.configuration
234234
stub_packer_source_path(component_name: components_directory,
235235
packer_source_path: packer_source_path)
236236
allow(ReactOnRails::Utils).to receive(:react_on_rails_pro?).and_return(true)
237-
allow(ReactOnRailsPro.configuration).to receive_messages(
238-
enable_rsc_support: true
237+
stub_const("ReactOnRailsPro::Utils", Class.new do
238+
def self.rsc_support_enabled?
239+
true
240+
end
241+
end)
242+
allow(ReactOnRailsPro::Utils).to receive_messages(
243+
rsc_support_enabled?: true
239244
)
240245
end
241246

@@ -309,7 +314,7 @@ def self.configuration
309314

310315
context "when RSC support is disabled" do
311316
before do
312-
allow(ReactOnRailsPro.configuration).to receive(:enable_rsc_support).and_return(false)
317+
allow(ReactOnRailsPro::Utils).to receive(:rsc_support_enabled?).and_return(false)
313318
described_class.instance.generate_packs_if_stale
314319
end
315320

0 commit comments

Comments
 (0)