Skip to content

Commit bb5c8fa

Browse files
justin808claude
andcommitted
Fix configuration tests by mocking PackerUtils.using_packer?
- Add proper mocks for ReactOnRails::PackerUtils.using_packer? in configuration tests - Ensures shakapacker_precompile validation logic triggers correctly in tests - Fixes CI failures where precompile? method was returning false due to missing mocks - All configuration tests now pass (43 tests) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 1f6a709 commit bb5c8fa

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

spec/react_on_rails/configuration_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ module ReactOnRails
7878
describe ".build_production_command" do
7979
context "when using Shakapacker 8" do
8080
it "fails when \"shakapacker_precompile\" is truly and \"build_production_command\" is truly" do
81+
allow(ReactOnRails::PackerUtils).to receive(:using_packer?).and_return(true)
8182
allow(Shakapacker).to receive_message_chain("config.shakapacker_precompile?")
8283
.and_return(true)
8384
expect do
@@ -88,6 +89,7 @@ module ReactOnRails
8889
end
8990

9091
it "doesn't fail when \"shakapacker_precompile\" is falsy and \"build_production_command\" is truly" do
92+
allow(ReactOnRails::PackerUtils).to receive(:using_packer?).and_return(true)
9193
allow(Shakapacker).to receive_message_chain("config.shakapacker_precompile?")
9294
.and_return(false)
9395
expect do
@@ -98,6 +100,7 @@ module ReactOnRails
98100
end
99101

100102
it "doesn't fail when \"shakapacker_precompile\" is truly and \"build_production_command\" is falsy" do
103+
allow(ReactOnRails::PackerUtils).to receive(:using_packer?).and_return(true)
101104
allow(Shakapacker).to receive_message_chain("config.shakapacker_precompile?")
102105
.and_return(true)
103106
expect do
@@ -106,6 +109,7 @@ module ReactOnRails
106109
end
107110

108111
it "doesn't fail when \"shakapacker_precompile\" is falsy and \"build_production_command\" is falsy" do
112+
allow(ReactOnRails::PackerUtils).to receive(:using_packer?).and_return(true)
109113
allow(Shakapacker).to receive_message_chain("config.shakapacker_precompile?")
110114
.and_return(false)
111115
expect do

0 commit comments

Comments
 (0)