diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2016-08-29 13:15:15 -0500 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2016-08-29 15:14:05 -0500 |
commit | 7a955ba5d763baed9106e07baa61f13d26628208 (patch) | |
tree | 577091776caf10899a40671f3cbf5ede26452748 | |
parent | c38c0a0bcb0518283520f54ff73e4cca726b9a22 (diff) | |
download | bundler-7a955ba5d763baed9106e07baa61f13d26628208.tar.gz |
[RemoteSpecification] Support respond_to? on 1.8.7
-rw-r--r-- | lib/bundler/remote_specification.rb | 5 | ||||
-rw-r--r-- | spec/bundler/remote_specification_spec.rb | 14 |
2 files changed, 9 insertions, 10 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/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 |