diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2018-07-21 22:28:26 -0700 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2018-07-29 16:50:25 -0700 |
commit | 3dabfcbec8317c80fae190ebd717f73e74ba3324 (patch) | |
tree | 6b9d72900f340030abcedf085d7b51bc2115bdd0 /spec/install/path_spec.rb | |
parent | 946e801679f9279b917a0e4427be6f71a1535011 (diff) | |
download | bundler-3dabfcbec8317c80fae190ebd717f73e74ba3324.tar.gz |
Update specs for path always including ruby scope
Diffstat (limited to 'spec/install/path_spec.rb')
-rw-r--r-- | spec/install/path_spec.rb | 96 |
1 files changed, 67 insertions, 29 deletions
diff --git a/spec/install/path_spec.rb b/spec/install/path_spec.rb index 3ed2b30cce..5f3fedb862 100644 --- a/spec/install/path_spec.rb +++ b/spec/install/path_spec.rb @@ -103,44 +103,82 @@ RSpec.describe "bundle install" do end [:env, :global].each do |type| - it "installs gems to a path if one is specified" do - set_bundle_path(type, bundled_app("vendor2").to_s) - bundle! :install, forgotten_command_line_options(:path => "vendor/bundle") + context "when set via #{type}" do + it "installs gems to a path if one is specified" do + set_bundle_path(type, bundled_app("vendor2").to_s) + bundle! :install, forgotten_command_line_options(:path => "vendor/bundle") + + expect(vendored_gems("gems/rack-1.0.0")).to be_directory + expect(bundled_app("vendor2")).not_to be_directory + expect(the_bundle).to include_gems "rack 1.0.0" + end - expect(vendored_gems("gems/rack-1.0.0")).to be_directory - expect(bundled_app("vendor2")).not_to be_directory - expect(the_bundle).to include_gems "rack 1.0.0" - end + context "with global_path_appends_ruby_scope set", :bundler => "2" do + it "installs gems to ." do + set_bundle_path(type, ".") + bundle! "config --global disable_shared_gems true" - it "installs gems to ." do - set_bundle_path(type, ".") - bundle! "config --global disable_shared_gems true" + bundle! :install - bundle! :install + paths_to_exist = %w[cache/rack-1.0.0.gem gems/rack-1.0.0 specifications/rack-1.0.0.gemspec].map {|path| bundled_app(Bundler.ruby_scope, path) } + expect(paths_to_exist).to all exist + expect(the_bundle).to include_gems "rack 1.0.0" + end - expect([bundled_app("cache/rack-1.0.0.gem"), bundled_app("gems/rack-1.0.0"), bundled_app("specifications/rack-1.0.0.gemspec")]).to all exist - expect(the_bundle).to include_gems "rack 1.0.0" - end + it "installs gems to the path" do + set_bundle_path(type, bundled_app("vendor").to_s) - it "installs gems to BUNDLE_PATH with #{type}" do - set_bundle_path(type, bundled_app("vendor").to_s) + bundle! :install - bundle :install + expect(bundled_app("vendor", Bundler.ruby_scope, "gems/rack-1.0.0")).to be_directory + expect(the_bundle).to include_gems "rack 1.0.0" + end - expect(bundled_app("vendor/gems/rack-1.0.0")).to be_directory - expect(the_bundle).to include_gems "rack 1.0.0" - end + it "installs gems to the path relative to root when relative" do + set_bundle_path(type, "vendor") - it "installs gems to BUNDLE_PATH relative to root when relative" do - set_bundle_path(type, "vendor") + FileUtils.mkdir_p bundled_app("lol") + Dir.chdir(bundled_app("lol")) do + bundle! :install + end - FileUtils.mkdir_p bundled_app("lol") - Dir.chdir(bundled_app("lol")) do - bundle :install + expect(bundled_app("vendor", Bundler.ruby_scope, "gems/rack-1.0.0")).to be_directory + expect(the_bundle).to include_gems "rack 1.0.0" + end end - expect(bundled_app("vendor/gems/rack-1.0.0")).to be_directory - expect(the_bundle).to include_gems "rack 1.0.0" + context "with global_path_appends_ruby_scope unset", :bundler => "< 2" do + it "installs gems to ." do + set_bundle_path(type, ".") + bundle! "config --global disable_shared_gems true" + + bundle! :install + + expect([bundled_app("cache/rack-1.0.0.gem"), bundled_app("gems/rack-1.0.0"), bundled_app("specifications/rack-1.0.0.gemspec")]).to all exist + expect(the_bundle).to include_gems "rack 1.0.0" + end + + it "installs gems to BUNDLE_PATH with #{type}" do + set_bundle_path(type, bundled_app("vendor").to_s) + + bundle :install + + expect(bundled_app("vendor/gems/rack-1.0.0")).to be_directory + expect(the_bundle).to include_gems "rack 1.0.0" + end + + it "installs gems to BUNDLE_PATH relative to root when relative" do + set_bundle_path(type, "vendor") + + FileUtils.mkdir_p bundled_app("lol") + Dir.chdir(bundled_app("lol")) do + bundle :install + end + + expect(bundled_app("vendor/gems/rack-1.0.0")).to be_directory + expect(the_bundle).to include_gems "rack 1.0.0" + end + end end end @@ -201,7 +239,7 @@ RSpec.describe "bundle install" do describe "to a file" do before do in_app_root do - `touch /tmp/idontexist bundle` + FileUtils.touch "bundle" end end @@ -212,7 +250,7 @@ RSpec.describe "bundle install" do G bundle :install, forgotten_command_line_options(:path => "bundle") - expect(out).to match(/file already exists/) + expect(out).to include("file already exists") end end end |