[rubygems/rubygems] util/rubocop -A --only Style/NumericLiterals

https://github.com/rubygems/rubygems/commit/860669b08a
This commit is contained in:
Hiroshi SHIBATA 2023-03-16 13:10:30 +09:00
Родитель 712d6e675b
Коммит d2cebb4e31
12 изменённых файлов: 46 добавлений и 46 удалений

Просмотреть файл

@ -267,7 +267,7 @@ class Gem::Package
tar.add_file_simple file, stat.mode, stat.size do |dst_io| tar.add_file_simple file, stat.mode, stat.size do |dst_io|
File.open file, "rb" do |src_io| File.open file, "rb" do |src_io|
dst_io.write src_io.read 16384 until src_io.eof? dst_io.write src_io.read 16_384 until src_io.eof?
end end
end end
end end
@ -362,7 +362,7 @@ EOM
algorithms.each do |algorithm| algorithms.each do |algorithm|
digester = Gem::Security.create_digest(algorithm) digester = Gem::Security.create_digest(algorithm)
digester << entry.read(16384) until entry.eof? digester << entry.read(16_384) until entry.eof?
entry.rewind entry.rewind
@ -701,7 +701,7 @@ EOM
def verify_gz(entry) # :nodoc: def verify_gz(entry) # :nodoc:
Zlib::GzipReader.wrap entry do |gzio| Zlib::GzipReader.wrap entry do |gzio|
gzio.read 16384 until gzio.eof? # gzip checksum verification gzio.read 16_384 until gzio.eof? # gzip checksum verification
end end
rescue Zlib::GzipFile::Error => e rescue Zlib::GzipFile::Error => e
raise Gem::Package::FormatError.new(e.message, entry.full_name) raise Gem::Package::FormatError.new(e.message, entry.full_name)

Просмотреть файл

@ -32,7 +32,7 @@ class Gem::S3URISigner
## ##
# Signs S3 URI using query-params according to the reference: https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html # Signs S3 URI using query-params according to the reference: https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html
def sign(expiration = 86400) def sign(expiration = 86_400)
s3_config = fetch_s3_config s3_config = fetch_s3_config
current_time = Time.now.utc current_time = Time.now.utc

Просмотреть файл

@ -359,7 +359,7 @@ module Gem::Security
## ##
# One day in seconds # One day in seconds
ONE_DAY = 86400 ONE_DAY = 86_400
## ##
# One year in seconds # One year in seconds

Просмотреть файл

@ -934,7 +934,7 @@ class Gem::TestCase < Test::Unit::TestCase
@a1 = quick_gem "a", "1" do |s| @a1 = quick_gem "a", "1" do |s|
s.files = %w[lib/code.rb] s.files = %w[lib/code.rb]
s.require_paths = %w[lib] s.require_paths = %w[lib]
s.date = Gem::Specification::TODAY - 86400 s.date = Gem::Specification::TODAY - 86_400
s.homepage = "http://a.example.com" s.homepage = "http://a.example.com"
s.email = %w[example@example.com example2@example.com] s.email = %w[example@example.com example2@example.com]
s.authors = %w[Example Example2] s.authors = %w[Example Example2]

Просмотреть файл

@ -1053,7 +1053,7 @@ class TestGem < Gem::TestCase
end end
def test_self_ruby_version_with_non_mri_implementations def test_self_ruby_version_with_non_mri_implementations
util_set_RUBY_VERSION "2.5.0", 0, 60928, "jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 25.171-b11 on 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11 [linux-x86_64]" util_set_RUBY_VERSION "2.5.0", 0, 60_928, "jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 25.171-b11 on 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11 [linux-x86_64]"
assert_equal Gem::Version.new("2.5.0"), Gem.ruby_version assert_equal Gem::Version.new("2.5.0"), Gem.ruby_version
ensure ensure
@ -1061,7 +1061,7 @@ class TestGem < Gem::TestCase
end end
def test_self_ruby_version_with_svn_prerelease def test_self_ruby_version_with_svn_prerelease
util_set_RUBY_VERSION "2.6.0", -1, 63539, "ruby 2.6.0preview2 (2018-05-31 trunk 63539) [x86_64-linux]" util_set_RUBY_VERSION "2.6.0", -1, 63_539, "ruby 2.6.0preview2 (2018-05-31 trunk 63539) [x86_64-linux]"
assert_equal Gem::Version.new("2.6.0.preview2"), Gem.ruby_version assert_equal Gem::Version.new("2.6.0.preview2"), Gem.ruby_version
ensure ensure
@ -1077,7 +1077,7 @@ class TestGem < Gem::TestCase
end end
def test_self_ruby_version_with_non_mri_implementations_with_mri_prerelase_compatibility def test_self_ruby_version_with_non_mri_implementations_with_mri_prerelase_compatibility
util_set_RUBY_VERSION "2.6.0", -1, 63539, "weirdjruby 9.2.0.0 (2.6.0preview2) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 25.171-b11 on 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11 [linux-x86_64]", "weirdjruby", "9.2.0.0" util_set_RUBY_VERSION "2.6.0", -1, 63_539, "weirdjruby 9.2.0.0 (2.6.0preview2) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 25.171-b11 on 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11 [linux-x86_64]", "weirdjruby", "9.2.0.0"
assert_equal Gem::Version.new("2.6.0.preview2"), Gem.ruby_version assert_equal Gem::Version.new("2.6.0.preview2"), Gem.ruby_version
ensure ensure
@ -1085,7 +1085,7 @@ class TestGem < Gem::TestCase
end end
def test_self_ruby_version_with_svn_trunk def test_self_ruby_version_with_svn_trunk
util_set_RUBY_VERSION "1.9.2", -1, 23493, "ruby 1.9.2dev (2009-05-20 trunk 23493) [x86_64-linux]" util_set_RUBY_VERSION "1.9.2", -1, 23_493, "ruby 1.9.2dev (2009-05-20 trunk 23493) [x86_64-linux]"
assert_equal Gem::Version.new("1.9.2.dev"), Gem.ruby_version assert_equal Gem::Version.new("1.9.2.dev"), Gem.ruby_version
ensure ensure

Просмотреть файл

@ -28,7 +28,7 @@ class TestGemCommandsStaleCommand < Gem::TestCase
filename = File.join(foo_bar.full_gem_path, file) filename = File.join(foo_bar.full_gem_path, file)
FileUtils.mkdir_p File.dirname filename FileUtils.mkdir_p File.dirname filename
FileUtils.touch(filename, :mtime => Time.now - 86400) FileUtils.touch(filename, :mtime => Time.now - 86_400)
end end
use_ui @stub_ui do use_ui @stub_ui do

Просмотреть файл

@ -9,7 +9,7 @@ class TestGemIndexer < Gem::TestCase
util_make_gems util_make_gems
@d2_0 = util_spec "d", "2.0" do |s| @d2_0 = util_spec "d", "2.0" do |s|
s.date = Gem::Specification::TODAY - 86400 * 3 s.date = Gem::Specification::TODAY - 86_400 * 3
end end
util_build_gem @d2_0 util_build_gem @d2_0

Просмотреть файл

@ -643,8 +643,8 @@ class TestGemPackage < Gem::Package::TarTestCase
pend "TMPDIR seems too long to add it as symlink into tar" if destination_user_dir.size > 90 pend "TMPDIR seems too long to add it as symlink into tar" if destination_user_dir.size > 90
tgz_io = util_tar_gz do |tar| tgz_io = util_tar_gz do |tar|
tar.add_symlink "link", destination_user_dir, 16877 tar.add_symlink "link", destination_user_dir, 16_877
tar.add_symlink "link/dir", ".", 16877 tar.add_symlink "link/dir", ".", 16_877
end end
expected_exceptions = win_platform? ? [Gem::Package::SymlinkError, Errno::EACCES] : [Gem::Package::SymlinkError] expected_exceptions = win_platform? ? [Gem::Package::SymlinkError, Errno::EACCES] : [Gem::Package::SymlinkError]

Просмотреть файл

@ -10,9 +10,9 @@ class TestGemPackageTarHeader < Gem::Package::TarTestCase
:name => "x", :name => "x",
:mode => 0644, :mode => 0644,
:uid => 1000, :uid => 1000,
:gid => 10000, :gid => 10_000,
:size => 100, :size => 100,
:mtime => 12345, :mtime => 12_345,
:typeflag => "0", :typeflag => "0",
:linkname => "link", :linkname => "link",
:uname => "user", :uname => "user",
@ -39,12 +39,12 @@ class TestGemPackageTarHeader < Gem::Package::TarTestCase
assert_equal "", @tar_header.checksum, "checksum" assert_equal "", @tar_header.checksum, "checksum"
assert_equal 1, @tar_header.devmajor, "devmajor" assert_equal 1, @tar_header.devmajor, "devmajor"
assert_equal 2, @tar_header.devminor, "devminor" assert_equal 2, @tar_header.devminor, "devminor"
assert_equal 10000, @tar_header.gid, "gid" assert_equal 10_000, @tar_header.gid, "gid"
assert_equal "group", @tar_header.gname, "gname" assert_equal "group", @tar_header.gname, "gname"
assert_equal "link", @tar_header.linkname, "linkname" assert_equal "link", @tar_header.linkname, "linkname"
assert_equal "ustar", @tar_header.magic, "magic" assert_equal "ustar", @tar_header.magic, "magic"
assert_equal 0644, @tar_header.mode, "mode" assert_equal 0644, @tar_header.mode, "mode"
assert_equal 12345, @tar_header.mtime, "mtime" assert_equal 12_345, @tar_header.mtime, "mtime"
assert_equal "x", @tar_header.name, "name" assert_equal "x", @tar_header.name, "name"
assert_equal "y", @tar_header.prefix, "prefix" assert_equal "y", @tar_header.prefix, "prefix"
assert_equal 100, @tar_header.size, "size" assert_equal 100, @tar_header.size, "size"
@ -195,13 +195,13 @@ tjmather\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
tar_header = Gem::Package::TarHeader.from stream tar_header = Gem::Package::TarHeader.from stream
assert_equal 1991400094, tar_header.uid assert_equal 1_991_400_094, tar_header.uid
assert_equal 1991400094, tar_header.gid assert_equal 1_991_400_094, tar_header.gid
assert_equal "GeoIP2-City_20190528/", tar_header.name assert_equal "GeoIP2-City_20190528/", tar_header.name
assert_equal 0755, tar_header.mode assert_equal 0755, tar_header.mode
assert_equal 0, tar_header.size assert_equal 0, tar_header.size
assert_equal 1559064640, tar_header.mtime assert_equal 1_559_064_640, tar_header.mtime
assert_equal 6932, tar_header.checksum assert_equal 6932, tar_header.checksum
end end

Просмотреть файл

@ -27,7 +27,7 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
end end
def test_add_file def test_add_file
Time.stub :now, Time.at(1458518157) do Time.stub :now, Time.at(1_458_518_157) do
@tar_writer.add_file "x", 0644 do |f| @tar_writer.add_file "x", 0644 do |f|
f.write "a" * 10 f.write "a" * 10
end end
@ -41,7 +41,7 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
def test_add_file_source_date_epoch def test_add_file_source_date_epoch
ENV["SOURCE_DATE_EPOCH"] = "123456789" ENV["SOURCE_DATE_EPOCH"] = "123456789"
Time.stub :now, Time.at(1458518157) do Time.stub :now, Time.at(1_458_518_157) do
@tar_writer.mkdir "foo", 0644 @tar_writer.mkdir "foo", 0644
assert_headers_equal tar_dir_header("foo", "", 0644, Time.at(ENV["SOURCE_DATE_EPOCH"].to_i).utc), assert_headers_equal tar_dir_header("foo", "", 0644, Time.at(ENV["SOURCE_DATE_EPOCH"].to_i).utc),
@ -50,7 +50,7 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
end end
def test_add_symlink def test_add_symlink
Time.stub :now, Time.at(1458518157) do Time.stub :now, Time.at(1_458_518_157) do
@tar_writer.add_symlink "x", "y", 0644 @tar_writer.add_symlink "x", "y", 0644
assert_headers_equal(tar_symlink_header("x", "", 0644, Time.now, "y"), assert_headers_equal(tar_symlink_header("x", "", 0644, Time.now, "y"),
@ -61,7 +61,7 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
def test_add_symlink_source_date_epoch def test_add_symlink_source_date_epoch
ENV["SOURCE_DATE_EPOCH"] = "123456789" ENV["SOURCE_DATE_EPOCH"] = "123456789"
Time.stub :now, Time.at(1458518157) do Time.stub :now, Time.at(1_458_518_157) do
@tar_writer.add_symlink "x", "y", 0644 @tar_writer.add_symlink "x", "y", 0644
assert_headers_equal(tar_symlink_header("x", "", 0644, Time.at(ENV["SOURCE_DATE_EPOCH"].to_i).utc, "y"), assert_headers_equal(tar_symlink_header("x", "", 0644, Time.at(ENV["SOURCE_DATE_EPOCH"].to_i).utc, "y"),
@ -72,7 +72,7 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
def test_add_file_digest def test_add_file_digest
digest_algorithms = OpenSSL::Digest::SHA1.new, OpenSSL::Digest::SHA512.new digest_algorithms = OpenSSL::Digest::SHA1.new, OpenSSL::Digest::SHA512.new
Time.stub :now, Time.at(1458518157) do Time.stub :now, Time.at(1_458_518_157) do
digests = @tar_writer.add_file_digest "x", 0644, digest_algorithms do |io| digests = @tar_writer.add_file_digest "x", 0644, digest_algorithms do |io|
io.write "a" * 10 io.write "a" * 10
end end
@ -95,7 +95,7 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
def test_add_file_digest_multiple def test_add_file_digest_multiple
digest_algorithms = [OpenSSL::Digest::SHA1.new, OpenSSL::Digest::SHA512.new] digest_algorithms = [OpenSSL::Digest::SHA1.new, OpenSSL::Digest::SHA512.new]
Time.stub :now, Time.at(1458518157) do Time.stub :now, Time.at(1_458_518_157) do
digests = @tar_writer.add_file_digest "x", 0644, digest_algorithms do |io| digests = @tar_writer.add_file_digest "x", 0644, digest_algorithms do |io|
io.write "a" * 10 io.write "a" * 10
end end
@ -120,7 +120,7 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
signer = Gem::Security::Signer.new PRIVATE_KEY, [PUBLIC_CERT] signer = Gem::Security::Signer.new PRIVATE_KEY, [PUBLIC_CERT]
Time.stub :now, Time.at(1458518157) do Time.stub :now, Time.at(1_458_518_157) do
@tar_writer.add_file_signed "x", 0644, signer do |io| @tar_writer.add_file_signed "x", 0644, signer do |io|
io.write "a" * 10 io.write "a" * 10
end end
@ -148,7 +148,7 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
def test_add_file_signer_empty def test_add_file_signer_empty
signer = Gem::Security::Signer.new nil, nil signer = Gem::Security::Signer.new nil, nil
Time.stub :now, Time.at(1458518157) do Time.stub :now, Time.at(1_458_518_157) do
@tar_writer.add_file_signed "x", 0644, signer do |io| @tar_writer.add_file_signed "x", 0644, signer do |io|
io.write "a" * 10 io.write "a" * 10
end end
@ -162,7 +162,7 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
end end
def test_add_file_simple def test_add_file_simple
Time.stub :now, Time.at(1458518157) do Time.stub :now, Time.at(1_458_518_157) do
@tar_writer.add_file_simple "x", 0644, 10 do |io| @tar_writer.add_file_simple "x", 0644, 10 do |io|
io.write "a" * 10 io.write "a" * 10
end end
@ -177,7 +177,7 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
def test_add_file_simple_source_date_epoch def test_add_file_simple_source_date_epoch
ENV["SOURCE_DATE_EPOCH"] = "123456789" ENV["SOURCE_DATE_EPOCH"] = "123456789"
Time.stub :now, Time.at(1458518157) do Time.stub :now, Time.at(1_458_518_157) do
@tar_writer.add_file_simple "x", 0644, 10 do |io| @tar_writer.add_file_simple "x", 0644, 10 do |io|
io.write "a" * 10 io.write "a" * 10
end end
@ -188,7 +188,7 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
end end
def test_add_file_simple_padding def test_add_file_simple_padding
Time.stub :now, Time.at(1458518157) do Time.stub :now, Time.at(1_458_518_157) do
@tar_writer.add_file_simple "x", 0, 100 @tar_writer.add_file_simple "x", 0, 100
assert_headers_equal tar_file_header("x", "", 0, 100, Time.now), assert_headers_equal tar_file_header("x", "", 0, 100, Time.now),
@ -246,7 +246,7 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
end end
def test_mkdir def test_mkdir
Time.stub :now, Time.at(1458518157) do Time.stub :now, Time.at(1_458_518_157) do
@tar_writer.mkdir "foo", 0644 @tar_writer.mkdir "foo", 0644
assert_headers_equal tar_dir_header("foo", "", 0644, Time.now), assert_headers_equal tar_dir_header("foo", "", 0644, Time.now),
@ -258,7 +258,7 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
def test_mkdir_source_date_epoch def test_mkdir_source_date_epoch
ENV["SOURCE_DATE_EPOCH"] = "123456789" ENV["SOURCE_DATE_EPOCH"] = "123456789"
Time.stub :now, Time.at(1458518157) do Time.stub :now, Time.at(1_458_518_157) do
@tar_writer.mkdir "foo", 0644 @tar_writer.mkdir "foo", 0644
assert_headers_equal tar_dir_header("foo", "", 0644, Time.at(ENV["SOURCE_DATE_EPOCH"].to_i).utc), assert_headers_equal tar_dir_header("foo", "", 0644, Time.at(ENV["SOURCE_DATE_EPOCH"].to_i).utc),

Просмотреть файл

@ -748,7 +748,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
"my-bucket" => { :id => "testuser", :secret => "testpass" }, "my-bucket" => { :id => "testuser", :secret => "testpass" },
} }
url = "s3://my-bucket/gems/specs.4.8.gz" url = "s3://my-bucket/gems/specs.4.8.gz"
Time.stub :now, Time.at(1561353581) do Time.stub :now, Time.at(1_561_353_581) do
assert_fetch_s3 url, "20f974027db2f3cd6193565327a7c73457a138efb1a63ea248d185ce6827d41b" assert_fetch_s3 url, "20f974027db2f3cd6193565327a7c73457a138efb1a63ea248d185ce6827d41b"
end end
ensure ensure
@ -760,7 +760,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
"my-bucket" => { :id => "testuser", :secret => "testpass", :region => "us-west-2" }, "my-bucket" => { :id => "testuser", :secret => "testpass", :region => "us-west-2" },
} }
url = "s3://my-bucket/gems/specs.4.8.gz" url = "s3://my-bucket/gems/specs.4.8.gz"
Time.stub :now, Time.at(1561353581) do Time.stub :now, Time.at(1_561_353_581) do
assert_fetch_s3 url, "4afc3010757f1fd143e769f1d1dabd406476a4fc7c120e9884fd02acbb8f26c9", nil, "us-west-2" assert_fetch_s3 url, "4afc3010757f1fd143e769f1d1dabd406476a4fc7c120e9884fd02acbb8f26c9", nil, "us-west-2"
end end
ensure ensure
@ -772,7 +772,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
"my-bucket" => { :id => "testuser", :secret => "testpass", :security_token => "testtoken" }, "my-bucket" => { :id => "testuser", :secret => "testpass", :security_token => "testtoken" },
} }
url = "s3://my-bucket/gems/specs.4.8.gz" url = "s3://my-bucket/gems/specs.4.8.gz"
Time.stub :now, Time.at(1561353581) do Time.stub :now, Time.at(1_561_353_581) do
assert_fetch_s3 url, "935160a427ef97e7630f799232b8f208c4a4e49aad07d0540572a2ad5fe9f93c", "testtoken" assert_fetch_s3 url, "935160a427ef97e7630f799232b8f208c4a4e49aad07d0540572a2ad5fe9f93c", "testtoken"
end end
ensure ensure
@ -787,7 +787,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
"my-bucket" => { :provider => "env" }, "my-bucket" => { :provider => "env" },
} }
url = "s3://my-bucket/gems/specs.4.8.gz" url = "s3://my-bucket/gems/specs.4.8.gz"
Time.stub :now, Time.at(1561353581) do Time.stub :now, Time.at(1_561_353_581) do
assert_fetch_s3 url, "20f974027db2f3cd6193565327a7c73457a138efb1a63ea248d185ce6827d41b" assert_fetch_s3 url, "20f974027db2f3cd6193565327a7c73457a138efb1a63ea248d185ce6827d41b"
end end
ensure ensure
@ -803,7 +803,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
"my-bucket" => { :provider => "env", :region => "us-west-2" }, "my-bucket" => { :provider => "env", :region => "us-west-2" },
} }
url = "s3://my-bucket/gems/specs.4.8.gz" url = "s3://my-bucket/gems/specs.4.8.gz"
Time.stub :now, Time.at(1561353581) do Time.stub :now, Time.at(1_561_353_581) do
assert_fetch_s3 url, "4afc3010757f1fd143e769f1d1dabd406476a4fc7c120e9884fd02acbb8f26c9", nil, "us-west-2" assert_fetch_s3 url, "4afc3010757f1fd143e769f1d1dabd406476a4fc7c120e9884fd02acbb8f26c9", nil, "us-west-2"
end end
ensure ensure
@ -819,7 +819,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
"my-bucket" => { :provider => "env" }, "my-bucket" => { :provider => "env" },
} }
url = "s3://my-bucket/gems/specs.4.8.gz" url = "s3://my-bucket/gems/specs.4.8.gz"
Time.stub :now, Time.at(1561353581) do Time.stub :now, Time.at(1_561_353_581) do
assert_fetch_s3 url, "935160a427ef97e7630f799232b8f208c4a4e49aad07d0540572a2ad5fe9f93c", "testtoken" assert_fetch_s3 url, "935160a427ef97e7630f799232b8f208c4a4e49aad07d0540572a2ad5fe9f93c", "testtoken"
end end
ensure ensure
@ -829,7 +829,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_fetch_s3_url_creds def test_fetch_s3_url_creds
url = "s3://testuser:testpass@my-bucket/gems/specs.4.8.gz" url = "s3://testuser:testpass@my-bucket/gems/specs.4.8.gz"
Time.stub :now, Time.at(1561353581) do Time.stub :now, Time.at(1_561_353_581) do
assert_fetch_s3 url, "20f974027db2f3cd6193565327a7c73457a138efb1a63ea248d185ce6827d41b" assert_fetch_s3 url, "20f974027db2f3cd6193565327a7c73457a138efb1a63ea248d185ce6827d41b"
end end
end end
@ -840,7 +840,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
} }
url = "s3://my-bucket/gems/specs.4.8.gz" url = "s3://my-bucket/gems/specs.4.8.gz"
Time.stub :now, Time.at(1561353581) do Time.stub :now, Time.at(1_561_353_581) do
assert_fetch_s3 url, "20f974027db2f3cd6193565327a7c73457a138efb1a63ea248d185ce6827d41b", nil, "us-east-1", assert_fetch_s3 url, "20f974027db2f3cd6193565327a7c73457a138efb1a63ea248d185ce6827d41b", nil, "us-east-1",
'{"AccessKeyId": "testuser", "SecretAccessKey": "testpass"}' '{"AccessKeyId": "testuser", "SecretAccessKey": "testpass"}'
end end
@ -854,7 +854,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
} }
url = "s3://my-bucket/gems/specs.4.8.gz" url = "s3://my-bucket/gems/specs.4.8.gz"
Time.stub :now, Time.at(1561353581) do Time.stub :now, Time.at(1_561_353_581) do
assert_fetch_s3 url, "4afc3010757f1fd143e769f1d1dabd406476a4fc7c120e9884fd02acbb8f26c9", nil, "us-west-2", assert_fetch_s3 url, "4afc3010757f1fd143e769f1d1dabd406476a4fc7c120e9884fd02acbb8f26c9", nil, "us-west-2",
'{"AccessKeyId": "testuser", "SecretAccessKey": "testpass"}' '{"AccessKeyId": "testuser", "SecretAccessKey": "testpass"}'
end end
@ -868,7 +868,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
} }
url = "s3://my-bucket/gems/specs.4.8.gz" url = "s3://my-bucket/gems/specs.4.8.gz"
Time.stub :now, Time.at(1561353581) do Time.stub :now, Time.at(1_561_353_581) do
assert_fetch_s3 url, "935160a427ef97e7630f799232b8f208c4a4e49aad07d0540572a2ad5fe9f93c", "testtoken", "us-east-1", assert_fetch_s3 url, "935160a427ef97e7630f799232b8f208c4a4e49aad07d0540572a2ad5fe9f93c", "testtoken", "us-east-1",
'{"AccessKeyId": "testuser", "SecretAccessKey": "testpass", "Token": "testtoken"}' '{"AccessKeyId": "testuser", "SecretAccessKey": "testpass", "Token": "testtoken"}'
end end

Просмотреть файл

@ -66,9 +66,9 @@ class TestUpdateSuggestion < Gem::TestCase
def test_eglible_for_update def test_eglible_for_update
with_eglible_environment(cmd: @cmd) do with_eglible_environment(cmd: @cmd) do
Time.stub :now, 123456789 do Time.stub :now, 123_456_789 do
assert @cmd.eglible_for_update? assert @cmd.eglible_for_update?
assert_equal Gem.configuration.last_update_check, 123456789 assert_equal Gem.configuration.last_update_check, 123_456_789
# test last check is written to config file # test last check is written to config file
assert File.read(Gem.configuration.state_file_name).match("123456789") assert File.read(Gem.configuration.state_file_name).match("123456789")