Skip to content

Commit 37e54a1

Browse files
justin808claude
andcommitted
Fix failing configuration tests by adding packer mocks
Two tests were missing the required packer.config.public_output_path mocking, causing nil errors during configuration setup. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 30e0e6d commit 37e54a1

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

spec/react_on_rails/configuration_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,12 @@ module ReactOnRails
282282
end
283283

284284
it "changes the configuration of the gem, such as setting the prerender option to false" do
285+
test_path = File.expand_path("public/webpack/test")
286+
allow(ReactOnRails::PackerUtils).to receive_message_chain("packer.config.public_output_path")
287+
.and_return(Pathname.new(test_path))
288+
285289
ReactOnRails.configure do |config|
290+
config.generated_assets_dir = test_path
286291
config.server_bundle_js_file = "server.js"
287292
config.prerender = false
288293
end
@@ -292,7 +297,12 @@ module ReactOnRails
292297
end
293298

294299
it "changes the configuration of the gem, such as setting the prerender option to true" do
300+
test_path = File.expand_path("public/webpack/test")
301+
allow(ReactOnRails::PackerUtils).to receive_message_chain("packer.config.public_output_path")
302+
.and_return(Pathname.new(test_path))
303+
295304
ReactOnRails.configure do |config|
305+
config.generated_assets_dir = test_path
296306
config.server_bundle_js_file = "something.js"
297307
config.prerender = true
298308
config.random_dom_id = false

spec/react_on_rails/packer_utils_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ module ReactOnRails
9292
end
9393

9494
describe ".supports_auto_registration?" do
95-
let(:mock_config) { double("MockConfig") }
96-
let(:mock_packer) { double("MockPacker", config: mock_config) }
95+
let(:mock_config) { double("MockConfig") } # rubocop:disable RSpec/VerifiedDoubles
96+
let(:mock_packer) { double("MockPacker", config: mock_config) } # rubocop:disable RSpec/VerifiedDoubles
9797

9898
before do
9999
allow(described_class).to receive(:packer).and_return(mock_packer)

0 commit comments

Comments
 (0)