Skip to content

Commit 4c31ad3

Browse files
facundofariasclaude
andcommitted
fix: Add flush before rewind in Tempfile tests
Add explicit f.flush call after f.write and before f.rewind in all Tempfile tests to ensure data is flushed from user-space buffer to disk before File.read reads the file. This prevents potential intermittent test failures due to buffered data not being visible to subsequent reads. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 7dbd6f8 commit 4c31ad3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

test/configuration_test.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def test_from_file_with_all_fields
4040

4141
Tempfile.create(['config', '.json']) do |f|
4242
f.write(JSON.generate(config_data))
43+
f.flush
4344
f.rewind
4445

4546
config = Deploy::Configuration.from_file(f.path)
@@ -62,6 +63,7 @@ def test_from_file_without_websocket_hostname
6263

6364
Tempfile.create(['config', '.json']) do |f|
6465
f.write(JSON.generate(config_data))
66+
f.flush
6567
f.rewind
6668

6769
config = Deploy::Configuration.from_file(f.path)
@@ -80,6 +82,7 @@ def test_from_file_raises_on_missing_file
8082
def test_from_file_raises_on_invalid_json
8183
Tempfile.create(['config', '.json']) do |f|
8284
f.write('invalid json {')
85+
f.flush
8386
f.rewind
8487

8588
assert_raises(JSON::ParserError) do

0 commit comments

Comments
 (0)