summaryrefslogtreecommitdiff
path: root/spec/bundler/commands
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2021-01-04 10:11:34 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2021-01-04 13:14:43 +0900
commit69ed64949b0c02d4b195809fa104ff23dd100093 (patch)
treec07abfd061a2da7610e252960c06a64e8b17e6c3 /spec/bundler/commands
parent5537adf719a37a30b17d39111cc03700f353aa2d (diff)
Track Bundler master(2.3.0.dev) branch at 55634a8af18a52df86c4275d70fa1179118bcc20
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4021
Diffstat (limited to 'spec/bundler/commands')
-rw-r--r--spec/bundler/commands/cache_spec.rb10
-rw-r--r--spec/bundler/commands/check_spec.rb4
-rw-r--r--spec/bundler/commands/config_spec.rb4
-rw-r--r--spec/bundler/commands/exec_spec.rb12
-rw-r--r--spec/bundler/commands/help_spec.rb16
-rw-r--r--spec/bundler/commands/install_spec.rb35
-rw-r--r--spec/bundler/commands/newgem_spec.rb10
-rw-r--r--spec/bundler/commands/post_bundle_message_spec.rb30
8 files changed, 72 insertions, 49 deletions
diff --git a/spec/bundler/commands/cache_spec.rb b/spec/bundler/commands/cache_spec.rb
index 173389c068..f4a57039ad 100644
--- a/spec/bundler/commands/cache_spec.rb
+++ b/spec/bundler/commands/cache_spec.rb
@@ -221,7 +221,7 @@ RSpec.describe "bundle cache" do
end
end
- bundle "config --local without wo"
+ bundle "config set --local without wo"
install_gemfile <<-G
source "file:#{gem_repo1}"
gem "rack"
@@ -237,7 +237,7 @@ RSpec.describe "bundle cache" do
expect(the_bundle).to include_gem "rack 1.0"
expect(the_bundle).not_to include_gems "weakling", "uninstallable"
- bundle "config --local without wo"
+ bundle "config set --local without wo"
bundle :install
expect(the_bundle).to include_gem "rack 1.0"
expect(the_bundle).not_to include_gems "weakling", "uninstallable"
@@ -254,7 +254,7 @@ RSpec.describe "bundle cache" do
end
subject do
- bundle "config --local frozen true"
+ bundle "config set --local frozen true"
bundle :cache, :raise_on_error => false
end
@@ -304,8 +304,8 @@ RSpec.describe "bundle install with gem sources" do
simulate_new_machine
FileUtils.rm_rf gem_repo2
- bundle "config --local deployment true"
- bundle "config --local path vendor/bundle"
+ bundle "config set --local deployment true"
+ bundle "config set --local path vendor/bundle"
bundle :install
expect(the_bundle).to include_gems "rack 1.0.0"
end
diff --git a/spec/bundler/commands/check_spec.rb b/spec/bundler/commands/check_spec.rb
index fdf3bc7d51..2fb03186be 100644
--- a/spec/bundler/commands/check_spec.rb
+++ b/spec/bundler/commands/check_spec.rb
@@ -124,7 +124,7 @@ RSpec.describe "bundle check" do
gem "rack", :group => :foo
G
- bundle "config --local without foo"
+ bundle "config set --local without foo"
bundle :install
gemfile <<-G
@@ -217,7 +217,7 @@ RSpec.describe "bundle check" do
gem "foo"
G
- bundle "config --local deployment true"
+ bundle "config set --local deployment true"
bundle "install"
FileUtils.rm(bundled_app_lock)
diff --git a/spec/bundler/commands/config_spec.rb b/spec/bundler/commands/config_spec.rb
index 70e3feff00..a7c0813210 100644
--- a/spec/bundler/commands/config_spec.rb
+++ b/spec/bundler/commands/config_spec.rb
@@ -45,7 +45,7 @@ RSpec.describe ".bundle/config" do
it "can be moved with an environment variable" do
ENV["BUNDLE_APP_CONFIG"] = tmp("foo/bar").to_s
- bundle "config --local path vendor/bundle"
+ bundle "config set --local path vendor/bundle"
bundle "install"
expect(bundled_app(".bundle")).not_to exist
@@ -57,7 +57,7 @@ RSpec.describe ".bundle/config" do
FileUtils.mkdir_p bundled_app("omg")
ENV["BUNDLE_APP_CONFIG"] = "../foo"
- bundle "config --local path vendor/bundle"
+ bundle "config set --local path vendor/bundle"
bundle "install", :dir => bundled_app("omg")
expect(bundled_app(".bundle")).not_to exist
diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb
index 1449bb642e..6485eb6a5a 100644
--- a/spec/bundler/commands/exec_spec.rb
+++ b/spec/bundler/commands/exec_spec.rb
@@ -295,7 +295,7 @@ RSpec.describe "bundle exec" do
end
it "handles gems installed with --without" do
- bundle "config --local without middleware"
+ bundle "config set --local without middleware"
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "rack" # rack 0.9.1 and 1.0 exist
@@ -448,35 +448,35 @@ RSpec.describe "bundle exec" do
with_fake_man do
bundle "#{exec} --help cat"
end
- expect(out).to include(%(["#{root}/man/bundle-exec.1"]))
+ expect(out).to include(%(["#{man_dir}/bundle-exec.1"]))
end
it "shows bundle-exec's man page when --help is before exec" do
with_fake_man do
bundle "--help #{exec}"
end
- expect(out).to include(%(["#{root}/man/bundle-exec.1"]))
+ expect(out).to include(%(["#{man_dir}/bundle-exec.1"]))
end
it "shows bundle-exec's man page when -h is before exec" do
with_fake_man do
bundle "-h #{exec}"
end
- expect(out).to include(%(["#{root}/man/bundle-exec.1"]))
+ expect(out).to include(%(["#{man_dir}/bundle-exec.1"]))
end
it "shows bundle-exec's man page when --help is after exec" do
with_fake_man do
bundle "#{exec} --help"
end
- expect(out).to include(%(["#{root}/man/bundle-exec.1"]))
+ expect(out).to include(%(["#{man_dir}/bundle-exec.1"]))
end
it "shows bundle-exec's man page when -h is after exec" do
with_fake_man do
bundle "#{exec} -h"
end
- expect(out).to include(%(["#{root}/man/bundle-exec.1"]))
+ expect(out).to include(%(["#{man_dir}/bundle-exec.1"]))
end
end
end
diff --git a/spec/bundler/commands/help_spec.rb b/spec/bundler/commands/help_spec.rb
index 03d34ef692..f72763900e 100644
--- a/spec/bundler/commands/help_spec.rb
+++ b/spec/bundler/commands/help_spec.rb
@@ -5,14 +5,14 @@ RSpec.describe "bundle help" do
with_fake_man do
bundle "help gemfile"
end
- expect(out).to eq(%(["#{root}/man/gemfile.5"]))
+ expect(out).to eq(%(["#{man_dir}/gemfile.5"]))
end
it "prefixes bundle commands with bundle- when finding the man files" do
with_fake_man do
bundle "help install"
end
- expect(out).to eq(%(["#{root}/man/bundle-install.1"]))
+ expect(out).to eq(%(["#{man_dir}/bundle-install.1"]))
end
it "simply outputs the human readable file when there is no man on the path" do
@@ -45,28 +45,28 @@ RSpec.describe "bundle help" do
with_fake_man do
bundle "install --help"
end
- expect(out).to eq(%(["#{root}/man/bundle-install.1"]))
+ expect(out).to eq(%(["#{man_dir}/bundle-install.1"]))
end
it "is called when the --help flag is used before the command" do
with_fake_man do
bundle "--help install"
end
- expect(out).to eq(%(["#{root}/man/bundle-install.1"]))
+ expect(out).to eq(%(["#{man_dir}/bundle-install.1"]))
end
it "is called when the -h flag is used before the command" do
with_fake_man do
bundle "-h install"
end
- expect(out).to eq(%(["#{root}/man/bundle-install.1"]))
+ expect(out).to eq(%(["#{man_dir}/bundle-install.1"]))
end
it "is called when the -h flag is used after the command" do
with_fake_man do
bundle "install -h"
end
- expect(out).to eq(%(["#{root}/man/bundle-install.1"]))
+ expect(out).to eq(%(["#{man_dir}/bundle-install.1"]))
end
it "has helpful output when using --help flag for a non-existent command" do
@@ -80,11 +80,11 @@ RSpec.describe "bundle help" do
with_fake_man do
bundle "--help"
end
- expect(out).to eq(%(["#{root}/man/bundle.1"]))
+ expect(out).to eq(%(["#{man_dir}/bundle.1"]))
with_fake_man do
bundle "-h"
end
- expect(out).to eq(%(["#{root}/man/bundle.1"]))
+ expect(out).to eq(%(["#{man_dir}/bundle.1"]))
end
end
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
diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb
index 421ffa80c6..8aca745bef 100644
--- a/spec/bundler/commands/newgem_spec.rb
+++ b/spec/bundler/commands/newgem_spec.rb
@@ -536,7 +536,7 @@ RSpec.describe "bundle gem" do
end
it "builds spec skeleton" do
- expect(bundled_app("#{gem_name}/test/#{require_path}_test.rb")).to exist
+ expect(bundled_app("#{gem_name}/test/test_#{require_path}.rb")).to exist
expect(bundled_app("#{gem_name}/test/test_helper.rb")).to exist
end
end
@@ -556,7 +556,7 @@ RSpec.describe "bundle gem" do
end
it "builds spec skeleton" do
- expect(bundled_app("#{gem_name}/test/#{require_path}_test.rb")).to exist
+ expect(bundled_app("#{gem_name}/test/test_#{require_path}.rb")).to exist
expect(bundled_app("#{gem_name}/test/test_helper.rb")).to exist
end
@@ -565,11 +565,11 @@ RSpec.describe "bundle gem" do
end
it "requires 'test_helper'" do
- expect(bundled_app("#{gem_name}/test/#{require_path}_test.rb").read).to include(%(require "test_helper"))
+ expect(bundled_app("#{gem_name}/test/test_#{require_path}.rb").read).to include(%(require "test_helper"))
end
it "creates a default test which fails" do
- expect(bundled_app("#{gem_name}/test/#{require_path}_test.rb").read).to include("assert false")
+ expect(bundled_app("#{gem_name}/test/test_#{require_path}.rb").read).to include("assert false")
end
end
@@ -589,7 +589,7 @@ RSpec.describe "bundle gem" do
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
- t.test_files = FileList["test/**/*_test.rb"]
+ t.test_files = FileList["test/**/test_*.rb"]
end
task default: :test
diff --git a/spec/bundler/commands/post_bundle_message_spec.rb b/spec/bundler/commands/post_bundle_message_spec.rb
index 2c965f0ddd..710152e59f 100644
--- a/spec/bundler/commands/post_bundle_message_spec.rb
+++ b/spec/bundler/commands/post_bundle_message_spec.rb
@@ -29,21 +29,21 @@ RSpec.describe "post bundle message" do
expect(out).to include(bundle_complete_message)
expect(out).to include(installed_gems_stats)
- bundle "config --local without emo"
+ bundle "config set --local without emo"
bundle :install
expect(out).to include(bundle_show_message)
expect(out).to include("Gems in the group emo were not installed")
expect(out).to include(bundle_complete_message)
expect(out).to include(installed_gems_stats)
- bundle "config --local without emo test"
+ bundle "config set --local without emo test"
bundle :install
expect(out).to include(bundle_show_message)
expect(out).to include("Gems in the groups emo and test were not installed")
expect(out).to include(bundle_complete_message)
expect(out).to include("4 Gemfile dependencies, 3 gems now installed.")
- bundle "config --local without emo obama test"
+ bundle "config set --local without emo obama test"
bundle :install
expect(out).to include(bundle_show_message)
expect(out).to include("Gems in the groups emo, obama and test were not installed")
@@ -55,28 +55,28 @@ RSpec.describe "post bundle message" do
let(:bundle_path) { "./vendor" }
it "shows proper messages according to the configured groups" do
- bundle "config --local path vendor"
+ bundle "config set --local path vendor"
bundle :install
expect(out).to include(bundle_show_path_message)
expect(out).to_not include("Gems in the group")
expect(out).to include(bundle_complete_message)
- bundle "config --local path vendor"
- bundle "config --local without emo"
+ bundle "config set --local path vendor"
+ bundle "config set --local without emo"
bundle :install
expect(out).to include(bundle_show_path_message)
expect(out).to include("Gems in the group emo were not installed")
expect(out).to include(bundle_complete_message)
- bundle "config --local path vendor"
- bundle "config --local without emo test"
+ bundle "config set --local path vendor"
+ bundle "config set --local without emo test"
bundle :install
expect(out).to include(bundle_show_path_message)
expect(out).to include("Gems in the groups emo and test were not installed")
expect(out).to include(bundle_complete_message)
- bundle "config --local path vendor"
- bundle "config --local without emo obama test"
+ bundle "config set --local path vendor"
+ bundle "config set --local without emo obama test"
bundle :install
expect(out).to include(bundle_show_path_message)
expect(out).to include("Gems in the groups emo, obama and test were not installed")
@@ -88,7 +88,7 @@ RSpec.describe "post bundle message" do
let(:bundle_path) { bundled_app("cache") }
it "shows proper messages according to the configured groups" do
- bundle "config --local path #{bundle_path}"
+ bundle "config set --local path #{bundle_path}"
bundle :install
expect(out).to include("Bundled gems are installed into `./cache`")
expect(out).to_not include("Gems in the group")
@@ -100,7 +100,7 @@ RSpec.describe "post bundle message" do
let(:bundle_path) { tmp("not_bundled_app") }
it "shows proper messages according to the configured groups" do
- bundle "config --local path #{bundle_path}"
+ bundle "config set --local path #{bundle_path}"
bundle :install
expect(out).to include("Bundled gems are installed into `#{tmp("not_bundled_app")}`")
expect(out).to_not include("Gems in the group")
@@ -193,19 +193,19 @@ The source does not contain any versions of 'not-a-gem'
expect(out).not_to include("Gems in the groups")
expect(out).to include(bundle_updated_message)
- bundle "config --local without emo"
+ bundle "config set --local without emo"
bundle :install
bundle :update, :all => true
expect(out).to include("Gems in the group emo were not updated")
expect(out).to include(bundle_updated_message)
- bundle "config --local without emo test"
+ bundle "config set --local without emo test"
bundle :install
bundle :update, :all => true
expect(out).to include("Gems in the groups emo and test were not updated")
expect(out).to include(bundle_updated_message)
- bundle "config --local without emo obama test"
+ bundle "config set --local without emo obama test"
bundle :install
bundle :update, :all => true
expect(out).to include("Gems in the groups emo, obama and test were not updated")