summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-10-20 21:00:55 -0500
committerSamuel Giddins <segiddins@segiddins.me>2016-10-20 21:00:55 -0500
commit6744aefdf1219f14fd9f6f16e6ecf9540089c06d (patch)
treeb12df2df3259db9dfd7f2bd7ef0624a0373f3d62
parent542594a8cc278799a3c465eb478fe17b3c5661d1 (diff)
downloadbundler-seg-public-gem.tar.gz
[RubygemsIntegration] Temporarily make #gem public againseg-public-gem
-rw-r--r--lib/bundler/rubygems_integration.rb4
-rw-r--r--spec/runtime/setup_spec.rb15
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