From 1fa3057257cf3bc73f1f003e5da42d7c56c6069a Mon Sep 17 00:00:00 2001 From: Kenji Okimoto Date: Tue, 23 Aug 2016 15:07:47 +0900 Subject: 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 --- lib/bundler/remote_specification.rb | 4 ++++ spec/bundler/remote_specification_spec.rb | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) 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 -- cgit v1.2.1