diff options
author | James Wen <jrw2175@columbia.edu> | 2016-05-18 18:35:01 -0400 |
---|---|---|
committer | James Wen <jrw2175@columbia.edu> | 2016-05-18 18:35:01 -0400 |
commit | b1d5c7d8469b07554c0e64c54c3995fb56136859 (patch) | |
tree | c0125ce3fa446259b2eea74b311e977b3c978bd2 | |
parent | 28cdc880281a524480ebfb092349fd94fae3b436 (diff) | |
download | bundler-b1d5c7d8469b07554c0e64c54c3995fb56136859.tar.gz |
Add integration spec for restoring `@gemfile` after `eval_gemfile`
-rw-r--r-- | lib/bundler/dsl.rb | 2 | ||||
-rw-r--r-- | spec/install/gemfile/eval_gemfile_spec.rb | 27 |
2 files changed, 23 insertions, 6 deletions
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index 1a53e68db7..2c68a7b87a 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -35,8 +35,8 @@ module Bundler def eval_gemfile(gemfile, contents = nil) expanded_gemfile_path = Pathname.new(gemfile).expand_path - @gemfile = expanded_gemfile_path original_gemfile = @gemfile + @gemfile = expanded_gemfile_path contents ||= Bundler.read_file(gemfile.to_s) instance_eval(contents, gemfile.to_s, 1) rescue Exception => e diff --git a/spec/install/gemfile/eval_gemfile_spec.rb b/spec/install/gemfile/eval_gemfile_spec.rb index ed6ecec467..2660ac98c2 100644 --- a/spec/install/gemfile/eval_gemfile_spec.rb +++ b/spec/install/gemfile/eval_gemfile_spec.rb @@ -2,18 +2,21 @@ require "spec_helper" describe "bundle install with gemfile that uses eval_gemfile" do + before do + build_lib("gunks", :path => bundled_app.join("gems/gunks")) do |s| + s.name = "gunks" + s.version = "0.0.1" + end + end + context "eval-ed Gemfile points to an internal gemspec" do before do - build_lib("gunks", :path => bundled_app.join("gems/gunks")) do |s| - s.name = "gunks" - s.version = "0.0.1" - end create_file "Gemfile-other", <<-G gemspec :path => 'gems/gunks' G end - it "should install the gemspec specified gem" do + it "installs the gemspec specified gem" do install_gemfile <<-G eval_gemfile 'Gemfile-other' G @@ -22,4 +25,18 @@ describe "bundle install with gemfile that uses eval_gemfile" do expect(out).to include("Bundle complete") end end + + context "Gemfile uses gemspec paths after eval-ing a Gemfile" do + before { create_file "other/Gemfile-other" } + + it "installs the gemspec specified gem" do + install_gemfile <<-G + eval_gemfile 'other/Gemfile-other' + gemspec :path => 'gems/gunks' + G + expect(out).to include("Resolving dependencies") + expect(out).to include("Using gunks 0.0.1 from source at `gems/gunks`") + expect(out).to include("Bundle complete") + end + end end |