diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2016-07-15 12:43:43 -0500 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2016-07-15 12:43:43 -0500 |
commit | 87569777f02e44085434c0cbc2f47af15e6e5c99 (patch) | |
tree | 810777cd859ea392a450e23b68e5f86c42f497ab | |
parent | 8a2d4cde7cfcb5416f3cf539e976da2208264d40 (diff) | |
download | bundler-87569777f02e44085434c0cbc2f47af15e6e5c99.tar.gz |
Fix legacy RubyGems compatibility
-rw-r--r-- | lib/bundler/rubygems_integration.rb | 10 | ||||
-rw-r--r-- | spec/bundler/dsl_spec.rb | 2 |
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 |