Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Auto merge of #4908 - okkez:add-missing-respond_to_missing, r=segiddins
Browse files Browse the repository at this point in the history
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
  • Loading branch information
homu committed Aug 23, 2016
2 parents 799f045 + 1fa3057 commit a160881
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/bundler/remote_specification.rb
Expand Up @@ -81,5 +81,9 @@ def _remote_specification
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
16 changes: 16 additions & 0 deletions spec/bundler/remote_specification_spec.rb
Expand Up @@ -171,4 +171,20 @@
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

0 comments on commit a160881

Please sign in to comment.