diff options
author | Homu <homu@barosl.com> | 2016-09-07 01:01:14 +0900 |
---|---|---|
committer | Homu <homu@barosl.com> | 2016-09-07 01:01:14 +0900 |
commit | 4cf318d1518f8c468c367a054e17b341d50694e8 (patch) | |
tree | df8e8ab2623b5aa55394dfa1114c83a92d553776 | |
parent | 1e37ee4d7197412c6267641ed70455d6950a9ce0 (diff) | |
parent | 0e24388a0065b15fc0ebc2bf8ae94a9b1de0114f (diff) | |
download | bundler-4cf318d1518f8c468c367a054e17b341d50694e8.tar.gz |
Auto merge of #4929 - bundler:seg-fix-1-8, r=segiddins
Fix the specs on 1.8.7
-rw-r--r-- | lib/bundler/remote_specification.rb | 5 | ||||
-rw-r--r-- | lib/bundler/rubygems_gem_installer.rb | 14 | ||||
-rw-r--r-- | spec/bundler/remote_specification_spec.rb | 14 |
3 files changed, 22 insertions, 11 deletions
diff --git a/lib/bundler/remote_specification.rb b/lib/bundler/remote_specification.rb index f45bf4a5ed..112c7f97fe 100644 --- a/lib/bundler/remote_specification.rb +++ b/lib/bundler/remote_specification.rb @@ -82,8 +82,9 @@ module Bundler _remote_specification.send(method, *args, &blk) end - def respond_to_missing?(method, include_all) - _remote_specification.respond_to?(method, include_all) + def respond_to?(method, include_all = false) + super || _remote_specification.respond_to?(method, include_all) end + public :respond_to? end end diff --git a/lib/bundler/rubygems_gem_installer.rb b/lib/bundler/rubygems_gem_installer.rb index 0aa9fd91d6..28ad988b94 100644 --- a/lib/bundler/rubygems_gem_installer.rb +++ b/lib/bundler/rubygems_gem_installer.rb @@ -28,7 +28,7 @@ module Bundler digest = Digest::SHA256.new digest << io.read(16_384) until io.eof? io.rewind - digest.send(checksum_type(checksum)) + send(checksum_type(checksum), digest) end unless digest == checksum raise SecurityError, @@ -48,5 +48,17 @@ module Bundler else raise InstallError, "The given checksum for #{spec.full_name} (#{checksum.inspect}) is not a valid SHA256 hexdigest nor base64digest" end end + + def hexdigest!(digest) + digest.hexdigest! + end + + def base64digest!(digest) + if digest.respond_to?(:base64digest!) + digest.base64digest! + else + [digest.digest!].pack("m0") + end + end end end diff --git a/spec/bundler/remote_specification_spec.rb b/spec/bundler/remote_specification_spec.rb index 28d78a82c7..d958ca85eb 100644 --- a/spec/bundler/remote_specification_spec.rb +++ b/spec/bundler/remote_specification_spec.rb @@ -158,32 +158,30 @@ describe Bundler::RemoteSpecification do describe "method missing" do context "and is present in Gem::Specification" do - let(:remote_spec) { double(:remote_spec) } + let(:remote_spec) { double(:remote_spec, :authors => "abcd") } before do - allow_any_instance_of(Gem::Specification).to receive(:respond_to?).and_return(true) allow(subject).to receive(:_remote_specification).and_return(remote_spec) + expect(subject.methods.map(&:to_sym)).not_to include(:authors) end it "should send through to Gem::Specification" do - expect(remote_spec).to receive(:send).with(:missing_method_call).once - subject.missing_method_call + expect(subject.authors).to eq("abcd") end end end describe "respond to missing?" do context "and is present in Gem::Specification" do - let(:remote_spec) { double(:remote_spec) } + let(:remote_spec) { double(:remote_spec, :authors => "abcd") } before do - allow_any_instance_of(Gem::Specification).to receive(:respond_to?).and_return(false) allow(subject).to receive(:_remote_specification).and_return(remote_spec) + expect(subject.methods.map(&:to_sym)).not_to include(:authors) end it "should send through to Gem::Specification" do - expect(remote_spec).to receive(:respond_to?).with(:missing_method_call, false).once - subject.respond_to?(:missing_method_call) + expect(subject.respond_to?(:authors)).to be_truthy end end end |