ruby-changes:70719
From: Nobuyoshi <ko1@a...>
Date: Tue, 4 Jan 2022 14:59:34 +0900 (JST)
Subject: [ruby-changes:70719] 5074aa1984 (master): [rubygems/rubygems] Test the actual checksums of the mock gems
https://git.ruby-lang.org/ruby.git/commit/?id=5074aa1984 From 5074aa19841dac0c1fcb037cd8306c5fe8e8516a Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Tue, 4 Jan 2022 13:30:14 +0900 Subject: [rubygems/rubygems] Test the actual checksums of the mock gems https://github.com/rubygems/rubygems/commit/2b42630959 --- spec/bundler/bundler/gem_helper_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spec/bundler/bundler/gem_helper_spec.rb b/spec/bundler/bundler/gem_helper_spec.rb index 2a6a6310742..5cd79de6203 100644 --- a/spec/bundler/bundler/gem_helper_spec.rb +++ b/spec/bundler/bundler/gem_helper_spec.rb @@ -66,6 +66,10 @@ RSpec.describe Bundler::GemHelper do https://github.com/ruby/ruby/blob/trunk/spec/bundler/bundler/gem_helper_spec.rb#L66 mock_confirm_message message end + def sha512_hexdigest(path) + Digest::SHA512.file(path).hexdigest + end + subject! { Bundler::GemHelper.new(app_path) } let(:app_version) { "0.1.0" } let(:app_gem_dir) { app_path.join("pkg") } @@ -183,6 +187,7 @@ RSpec.describe Bundler::GemHelper do https://github.com/ruby/ruby/blob/trunk/spec/bundler/bundler/gem_helper_spec.rb#L187 mock_checksum_message app_name, app_version subject.build_checksum expect(app_sha_path).to exist + expect(File.read(app_sha_path).chomp).to eql(sha512_hexdigest(app_gem_path)) end end context "when building in the current working directory" do @@ -193,6 +198,7 @@ RSpec.describe Bundler::GemHelper do https://github.com/ruby/ruby/blob/trunk/spec/bundler/bundler/gem_helper_spec.rb#L198 Bundler::GemHelper.new.build_checksum end expect(app_sha_path).to exist + expect(File.read(app_sha_path).chomp).to eql(sha512_hexdigest(app_gem_path)) end end context "when building in a location relative to the current working directory" do @@ -203,6 +209,7 @@ RSpec.describe Bundler::GemHelper do https://github.com/ruby/ruby/blob/trunk/spec/bundler/bundler/gem_helper_spec.rb#L209 Bundler::GemHelper.new(File.basename(app_path)).build_checksum end expect(app_sha_path).to exist + expect(File.read(app_sha_path).chomp).to eql(sha512_hexdigest(app_gem_path)) end end end -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/