[rubygems/rubygems] Update TarWriter test to store mtime in a variable

0e2cec3fa3
This commit is contained in:
Ellen Marie Dash 2025-05-05 18:03:26 -04:00 committed by Hiroshi SHIBATA
parent 819ecd115d
commit a41eed99c0
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2

View file

@ -52,11 +52,13 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
def test_add_file_with_mtime
Time.stub :now, Time.at(1_458_518_157) do
@tar_writer.add_file "x", 0o644, Time.now do |f|
mtime = Time.now
@tar_writer.add_file "x", 0o644, mtime do |f|
f.write "a" * 10
end
assert_headers_equal(tar_file_header("x", "", 0o644, 10, Time.now),
assert_headers_equal(tar_file_header("x", "", 0o644, 10, mtime),
@io.string[0, 512])
end
end