summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenji Okimoto <okimoto@clear-code.com>2016-08-23 15:07:47 +0900
committerKenji Okimoto <okimoto@clear-code.com>2016-08-23 15:42:12 +0900
commit1fa3057257cf3bc73f1f003e5da42d7c56c6069a (patch)
tree30da40de52cb98816a48b63e25b6c8b2a5254d68
parentcdd286377909e8f1c116ce176a2a4c78105ab2fd (diff)
downloadbundler-1fa3057257cf3bc73f1f003e5da42d7c56c6069a.tar.gz
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