diff options
Diffstat (limited to 'spec/bundler/commands/install_spec.rb')
-rw-r--r-- | spec/bundler/commands/install_spec.rb | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb index 043805df79..c91864dbb8 100644 --- a/spec/bundler/commands/install_spec.rb +++ b/spec/bundler/commands/install_spec.rb @@ -291,7 +291,7 @@ RSpec.describe "bundle install with gem sources" do end it "works" do - bundle "config --local path vendor" + bundle "config set --local path vendor" bundle "install" expect(the_bundle).to include_gems "rack 1.0" end @@ -580,8 +580,31 @@ RSpec.describe "bundle install with gem sources" do end describe "when bundle path does not have write access", :permissions do + let(:bundle_path) { bundled_app("vendor") } + + before do + FileUtils.mkdir_p(bundle_path) + gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem 'rack' + G + end + + it "should display a proper message to explain the problem" do + FileUtils.chmod(0o500, bundle_path) + + bundle "config set --local path vendor" + bundle :install, :raise_on_error => false + expect(err).to include(bundle_path.to_s) + expect(err).to include("grant write permissions") + end + end + + describe "when bundle cache path does not have write access", :permissions do + let(:cache_path) { bundled_app("vendor/#{Bundler.ruby_scope}/cache") } + before do - FileUtils.mkdir_p(bundled_app("vendor")) + FileUtils.mkdir_p(cache_path) gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem 'rack' @@ -589,11 +612,11 @@ RSpec.describe "bundle install with gem sources" do end it "should display a proper message to explain the problem" do - FileUtils.chmod(0o500, bundled_app("vendor")) + FileUtils.chmod(0o500, cache_path) - bundle "config --local path vendor" + bundle "config set --local path vendor" bundle :install, :raise_on_error => false - expect(err).to include(bundled_app("vendor").to_s) + expect(err).to include(cache_path.to_s) expect(err).to include("grant write permissions") end end @@ -604,7 +627,7 @@ RSpec.describe "bundle install with gem sources" do source "#{file_uri_for(gem_repo1)}" gem "rack" G - bundle "config --local path bundle" + bundle "config set --local path bundle" bundle "install", :standalone => true end |