Skip to content

Commit f319b5e

Browse files
justin808claude
andcommitted
Fix ProcessManager test stubbing for system calls
The tests were expecting system() to be called with a single string, but the implementation correctly uses array arguments for security. Updated tests to match the implementation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 39983c7 commit f319b5e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

spec/react_on_rails/dev/pack_generator_spec.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
command = "bundle exec rake react_on_rails:generate_packs > /dev/null 2>&1"
3333
allow_any_instance_of(Object).to receive(:system).with(command).and_return(false)
3434

35+
# Suppress the puts output
36+
allow_any_instance_of(Object).to receive(:puts)
37+
3538
expect { described_class.generate(verbose: false) }.to raise_error(SystemExit)
3639
end
3740
end

spec/react_on_rails/dev/process_manager_spec.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,20 @@
4646
before do
4747
allow(ReactOnRails::Dev::FileManager).to receive(:cleanup_stale_files)
4848
allow_any_instance_of(Kernel).to receive(:system).and_return(true)
49+
allow(File).to receive(:readable?).and_return(true)
4950
end
5051

5152
it "uses overmind when available" do
5253
allow(described_class).to receive(:installed?).with("overmind").and_return(true)
53-
expect_any_instance_of(Kernel).to receive(:system).with("overmind start -f Procfile.dev")
54+
expect_any_instance_of(Kernel).to receive(:system).with("overmind", "start", "-f", "Procfile.dev")
5455

5556
described_class.run_with_process_manager("Procfile.dev")
5657
end
5758

5859
it "uses foreman when overmind not available" do
5960
allow(described_class).to receive(:installed?).with("overmind").and_return(false)
6061
allow(described_class).to receive(:installed?).with("foreman").and_return(true)
61-
expect_any_instance_of(Kernel).to receive(:system).with("foreman start -f Procfile.dev")
62+
expect_any_instance_of(Kernel).to receive(:system).with("foreman", "start", "-f", "Procfile.dev")
6263

6364
described_class.run_with_process_manager("Procfile.dev")
6465
end

0 commit comments

Comments
 (0)