diff options
-rw-r--r-- | lib/bundler/rubygems_integration.rb | 4 | ||||
-rw-r--r-- | spec/runtime/setup_spec.rb | 15 |
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 488aa8b9a4..ec1a408715 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -353,6 +353,10 @@ module Bundler true end + + # TODO: delete this in 2.0, it's a backwards compatibility shim + # see https://github.com/bundler/bundler/issues/5102 + kernel_class.send(:public, :gem) end end diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb index eab66e2ee2..1251f25d80 100644 --- a/spec/runtime/setup_spec.rb +++ b/spec/runtime/setup_spec.rb @@ -1094,4 +1094,19 @@ describe "Bundler.setup" do expect(post_bundler).to match(/\d+\.\d+\.\d+/) end end + + describe "after setup" do + it "allows calling #gem on random objects" do + install_gemfile <<-G + source "file:#{gem_repo1}" + gem "rack" + G + ruby! <<-RUBY + require "bundler/setup" + Object.new.gem "rack" + puts Gem.loaded_specs["rack"].full_name + RUBY + expect(out).to eq("rack-1.0.0") + end + end end |