Skip to content

Commit

Permalink
Make sure to clear file when updating in remote test helper
Browse files Browse the repository at this point in the history
  • Loading branch information
chvp committed Mar 21, 2023
1 parent a8cf106 commit 8f3e86b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions test/testhelpers/remote_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,8 @@ def update_json(rel_path, msg = nil)
end

def update_file(rel_path, msg = nil)
File.open(File.join(@path, rel_path), 'r+') do |f|
contents = f.read
f.seek(0, IO::SEEK_SET)
f.write(yield contents)
end
contents = File.read(File.join(@path, rel_path))
File.write(File.join(@path, rel_path), (yield contents))
msg ||= "update #{rel_path}"
commit msg
end
Expand Down

0 comments on commit 8f3e86b

Please sign in to comment.