diff options
Diffstat (limited to 'spec/install/path_spec.rb')
-rw-r--r-- | spec/install/path_spec.rb | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/spec/install/path_spec.rb b/spec/install/path_spec.rb index 59d151e5bf..5f3fedb862 100644 --- a/spec/install/path_spec.rb +++ b/spec/install/path_spec.rb @@ -23,7 +23,7 @@ RSpec.describe "bundle install" do dir.mkpath Dir.chdir(dir) do - bundle! :install, forgotten_command_line_options(:path => "vendor/bundle") + bundle! :install, forgotten_command_line_options(:path => dir.join("vendor/bundle")) expect(out).to include("installed into `./vendor/bundle`") end @@ -49,6 +49,37 @@ RSpec.describe "bundle install" do expect(vendored_gems("gems/rack-1.0.0")).to be_directory expect(the_bundle).to include_gems "rack 1.0.0" end + + context "with path_relative_to_cwd set to true" do + before { bundle! "config path_relative_to_cwd true" } + + it "installs the bundle relatively to current working directory", :bundler => "< 2" do + Dir.chdir(bundled_app.parent) do + bundle! "install --gemfile='#{bundled_app}/Gemfile' --path vendor/bundle" + expect(out).to include("installed into `./vendor/bundle`") + expect(bundled_app("../vendor/bundle")).to be_directory + end + expect(the_bundle).to include_gems "rack 1.0.0" + end + + it "installs the standalone bundle relative to the cwd" do + Dir.chdir(bundled_app.parent) do + bundle! :install, :gemfile => bundled_app("Gemfile"), :standalone => true + expect(out).to include("installed into `./bundled_app/bundle`") + expect(bundled_app("bundle")).to be_directory + expect(bundled_app("bundle/ruby")).to be_directory + end + + bundle! "config unset path" + + Dir.chdir(bundled_app("subdir").tap(&:mkpath)) do + bundle! :install, :gemfile => bundled_app("Gemfile"), :standalone => true + expect(out).to include("installed into `../bundle`") + expect(bundled_app("bundle")).to be_directory + expect(bundled_app("bundle/ruby")).to be_directory + end + end + end end describe "when BUNDLE_PATH or the global path config is set" do |