Skip to content

Commit dd9e6f8

Browse files
justin808claude
andcommitted
Fix test stubbing issues for CI compatibility
- Fixed PackGenerator test to stub system calls on the class instead of Kernel - Improved FileManager test stubbing to use call_original for better compatibility - These changes should resolve CI test failures while maintaining functionality 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 3bad387 commit dd9e6f8

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

spec/dummy/Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ PATH
77
execjs (~> 2.5)
88
rails (>= 5.2)
99
rainbow (~> 3.0)
10-
shakapacker (~> 8.0)
10+
shakapacker (~> 8.2)
1111

1212
GEM
1313
remote: https://rubygems.org/

spec/react_on_rails/dev/file_manager_spec.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@
2828
end
2929

3030
it "removes stale overmind socket files" do
31-
allow(File).to receive(:exist?).and_return(false) # Default to false for any other files
31+
# Setup File.exist? stubs for all expected calls
32+
allow(File).to receive(:exist?).and_call_original
3233
allow(File).to receive(:exist?).with(".overmind.sock").and_return(true)
3334
allow(File).to receive(:exist?).with("tmp/sockets/overmind.sock").and_return(false)
3435
allow(File).to receive(:exist?).with("tmp/pids/server.pid").and_return(false)
3536

36-
expect(File).to receive(:delete).with(".overmind.sock").and_return(nil)
37+
# Setup File.delete expectation
38+
expect(File).to receive(:delete).with(".overmind.sock").and_return(1)
3739

3840
result = described_class.cleanup_stale_files
3941
expect(result).to be true

spec/react_on_rails/dev/pack_generator_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@
77
describe ".generate" do
88
it "runs pack generation successfully in verbose mode" do
99
command = "bundle exec rake react_on_rails:generate_packs"
10-
allow(Kernel).to receive(:system).with(command).and_return(true)
10+
allow(described_class).to receive(:system).with(command).and_return(true)
1111

1212
expect { described_class.generate(verbose: true) }.to output.to_stdout_from_any_process
1313
end
1414

1515
it "runs pack generation successfully in quiet mode" do
1616
command = "bundle exec rake react_on_rails:generate_packs > /dev/null 2>&1"
17-
allow(Kernel).to receive(:system).with(command).and_return(true)
17+
allow(described_class).to receive(:system).with(command).and_return(true)
1818

1919
expect { described_class.generate(verbose: false) }.not_to output.to_stdout_from_any_process
2020
end
2121

2222
it "exits with error when pack generation fails" do
2323
command = "bundle exec rake react_on_rails:generate_packs > /dev/null 2>&1"
24-
allow(Kernel).to receive(:system).with(command).and_return(false)
24+
allow(described_class).to receive(:system).with(command).and_return(false)
2525

2626
expect { described_class.generate(verbose: false) }.to raise_error(SystemExit)
2727
end

0 commit comments

Comments
 (0)