summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHomu <homu@barosl.com>2016-08-23 22:20:03 +0900
committerHomu <homu@barosl.com>2016-08-23 22:20:03 +0900
commita160881e6bf9a8145608ab4183f5d2c592d56875 (patch)
tree5221e70630961c9e925be80984b1d8088d3b6605
parent799f045c4aa8572fefd8250025e59365340612b9 (diff)
parent1fa3057257cf3bc73f1f003e5da42d7c56c6069a (diff)
downloadbundler-a160881e6bf9a8145608ab4183f5d2c592d56875.tar.gz
Auto merge of #4908 - okkez:add-missing-respond_to_missing, r=segiddins
Add missing definition of `respond_to_missing?` Because we should overwrite this method when we overwrite `method_missing`. See http://ruby-doc.org/core-2.3.1/BasicObject.html#method-i-method_missing
-rw-r--r--lib/bundler/remote_specification.rb4
-rw-r--r--spec/bundler/remote_specification_spec.rb16
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/bundler/remote_specification.rb b/lib/bundler/remote_specification.rb
index 6a02897c63..f45bf4a5ed 100644
--- a/lib/bundler/remote_specification.rb
+++ b/lib/bundler/remote_specification.rb
@@ -81,5 +81,9 @@ module Bundler
def method_missing(method, *args, &blk)
_remote_specification.send(method, *args, &blk)
end
+
+ def respond_to_missing?(method, include_all)
+ _remote_specification.respond_to?(method, include_all)
+ end
end
end
diff --git a/spec/bundler/remote_specification_spec.rb b/spec/bundler/remote_specification_spec.rb
index 6a8e9a6434..28d78a82c7 100644
--- a/spec/bundler/remote_specification_spec.rb
+++ b/spec/bundler/remote_specification_spec.rb
@@ -171,4 +171,20 @@ describe Bundler::RemoteSpecification do
end
end
end
+
+ describe "respond to missing?" do
+ context "and is present in Gem::Specification" do
+ let(:remote_spec) { double(:remote_spec) }
+
+ 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)
+ 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)
+ end
+ end
+ end
end