summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-07-15 12:43:43 -0500
committerSamuel Giddins <segiddins@segiddins.me>2016-07-19 17:13:44 -0500
commit752ad8a4c10d6f43eecbfdf8b6a3c7f692ab9692 (patch)
treeab3487e8a5594946e3a47fa81817d93997270f21
parentbd491f0e44d9f0ba5497f29e24a8ca110f8eec89 (diff)
downloadbundler-752ad8a4c10d6f43eecbfdf8b6a3c7f692ab9692.tar.gz
Fix legacy RubyGems compatibility
-rw-r--r--lib/bundler/rubygems_integration.rb10
-rw-r--r--spec/bundler/dsl_spec.rb2
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index 37d937cc74..a083247adc 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -517,11 +517,11 @@ module Bundler
def stub_rubygems(specs)
# Rubygems versions lower than 1.7 use SourceIndex#from_gems_in
source_index_class = (class << Gem::SourceIndex; self; end)
- redefine_method(source_index, source_index_class) do |*args|
- source_index = Gem::SourceIndex.new
- source_index.spec_dirs = *args
- source_index.add_specs(*specs)
- source_index
+ redefine_method(source_index_class, :from_gems_in) do |*args|
+ Gem::SourceIndex.new.tap do |source_index|
+ source_index.spec_dirs = *args
+ source_index.add_specs(*specs)
+ end
end
end
diff --git a/spec/bundler/dsl_spec.rb b/spec/bundler/dsl_spec.rb
index 77d663d754..00d36dd55f 100644
--- a/spec/bundler/dsl_spec.rb
+++ b/spec/bundler/dsl_spec.rb
@@ -80,7 +80,7 @@ describe Bundler::Dsl do
it "handles syntax errors with a useful message" do
expect(Bundler).to receive(:read_file).with("Gemfile").and_return("}")
expect { subject.eval_gemfile("Gemfile") }.
- to raise_error(Bundler::GemfileError, /There was an error parsing `Gemfile`: (syntax error, unexpected tSTRING_DEND|(compile error - )?syntax error, unexpected '}'). Bundler cannot continue./)
+ to raise_error(Bundler::GemfileError, /There was an error parsing `Gemfile`: (syntax error, unexpected tSTRING_DEND|(compile error - )?syntax error, unexpected '\}'). Bundler cannot continue./)
end
it "distinguishes syntax errors from evaluation errors" do