summaryrefslogtreecommitdiff
path: root/spec/bundler/commands
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2021-01-14 13:38:17 +0900
committerNARUSE, Yui <nurse@users.noreply.github.com>2021-01-14 16:44:42 +0900
commit93dcf0828dc8e627e0c24497795d927911a9d993 (patch)
tree391f87ebf731d82c74fc44322a012024c3bd62f7 /spec/bundler/commands
parentc721e36ceca587d823a765cbbad90911a20cffce (diff)
Merge Bundler-2.2.5
Diffstat (limited to 'spec/bundler/commands')
-rw-r--r--spec/bundler/commands/install_spec.rb29
-rw-r--r--spec/bundler/commands/newgem_spec.rb8
2 files changed, 29 insertions, 8 deletions
diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb
index 043805df79..f12d32d6a8 100644
--- a/spec/bundler/commands/install_spec.rb
+++ b/spec/bundler/commands/install_spec.rb
@@ -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 :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
diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb
index 421ffa80c6..265268a1fe 100644
--- a/spec/bundler/commands/newgem_spec.rb
+++ b/spec/bundler/commands/newgem_spec.rb
@@ -12,10 +12,10 @@ RSpec.describe "bundle gem" do
def bundle_exec_rubocop
prepare_gemspec(bundled_app(gem_name, "#{gem_name}.gemspec"))
- rubocop_version = RUBY_VERSION > "2.4" ? "0.90.0" : "0.80.1"
+ rubocop_version = RUBY_VERSION > "2.4" ? "1.7.0" : "0.81.0"
gems = ["minitest", "rake", "rake-compiler", "rspec", "rubocop -v #{rubocop_version}", "test-unit"]
gems.unshift "parallel -v 1.19.2" if RUBY_VERSION < "2.5"
- gems += ["rubocop-ast -v 0.4.0"] if rubocop_version == "0.90.0"
+ gems += ["rubocop-ast -v 1.4.0"] if rubocop_version == "1.7.0"
path = Bundler.feature_flag.default_install_uses_path? ? local_gem_path(:base => bundled_app(gem_name)) : system_gem_path
realworld_system_gems gems, :path => path
bundle "exec rubocop --debug --config .rubocop.yml", :dir => bundled_app(gem_name)
@@ -416,9 +416,7 @@ RSpec.describe "bundle gem" do
it "sets a minimum ruby version" do
bundle "gem #{gem_name}"
- bundler_gemspec = Bundler::GemHelper.new(gemspec_dir).gemspec
-
- expect(bundler_gemspec.required_ruby_version).to eq(generated_gemspec.required_ruby_version)
+ expect(generated_gemspec.required_ruby_version).to eq(Gem::Requirement.new(Gem.ruby_version < Gem::Version.new("2.4.a") ? ">= 2.3.0" : ">= 2.4.0"))
end
it "requires the version file" do