aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2020-05-21 21:05:07 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-05-22 20:32:30 +0900
commit1d889c96562e9619d2cab443da711e82daeb983c (patch)
tree0a6a142360be987ceaff6cbf24a03fd5797ecb66 /spec
parent93ebf9643dc0913693157e6b4bb391a549a9b8ae (diff)
downloadruby-1d889c96562e9619d2cab443da711e82daeb983c.tar.gz
Sync Bundler PR #3624 with HEAD commits
Diffstat (limited to 'spec')
-rw-r--r--spec/bundler/commands/exec_spec.rb19
-rw-r--r--spec/bundler/other/major_deprecation_spec.rb25
-rw-r--r--spec/bundler/runtime/gem_tasks_spec.rb31
-rw-r--r--spec/bundler/runtime/setup_spec.rb10
4 files changed, 60 insertions, 25 deletions
diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb
index 773ee5fab5..b387419726 100644
--- a/spec/bundler/commands/exec_spec.rb
+++ b/spec/bundler/commands/exec_spec.rb
@@ -930,5 +930,24 @@ __FILE__: #{path.to_s.inspect}
expect(err).to include("custom openssl should not be loaded")
end
end
+
+ context "with a git gem that includes extensions" do
+ before do
+ build_git "simple_git_binary", &:add_c_extension
+ bundle! "config set --local path .bundle"
+ install_gemfile! <<-G
+ gem "simple_git_binary", :git => '#{lib_path("simple_git_binary-1.0")}'
+ G
+ end
+
+ it "allows calling bundle install" do
+ bundle! "exec bundle install"
+ end
+
+ it "allows calling bundle install after removing gem.build_complete" do
+ FileUtils.rm_rf Dir[bundled_app(".bundle/**/gem.build_complete")]
+ bundle! "exec #{Gem.ruby} -S bundle install"
+ end
+ end
end
end
diff --git a/spec/bundler/other/major_deprecation_spec.rb b/spec/bundler/other/major_deprecation_spec.rb
index e9398e3b24..102588e97a 100644
--- a/spec/bundler/other/major_deprecation_spec.rb
+++ b/spec/bundler/other/major_deprecation_spec.rb
@@ -314,17 +314,18 @@ RSpec.describe "major deprecations" do
end
{
- :clean => true,
- :deployment => true,
- :frozen => true,
- :"no-cache" => true,
- :"no-prune" => true,
- :path => "vendor/bundle",
- :shebang => "ruby27",
- :system => true,
- :without => "development",
- :with => "development",
- }.each do |name, value|
+ "clean" => ["clean", true],
+ "deployment" => ["deployment", true],
+ "frozen" => ["frozen", true],
+ "no-cache" => ["no_cache", true],
+ "no-prune" => ["no_prune", true],
+ "path" => ["path", "vendor/bundle"],
+ "shebang" => ["shebang", "ruby27"],
+ "system" => ["system", true],
+ "without" => ["without", "development"],
+ "with" => ["with", "development"],
+ }.each do |name, expectations|
+ option_name, value = *expectations
flag_name = "--#{name}"
context "with the #{flag_name} flag" do
@@ -338,7 +339,7 @@ RSpec.describe "major deprecations" do
"The `#{flag_name}` flag is deprecated because it relies on " \
"being remembered across bundler invocations, which bundler " \
"will no longer do in future versions. Instead please use " \
- "`bundle config set #{name} '#{value}'`, and stop using this flag"
+ "`bundle config set #{option_name} '#{value}'`, and stop using this flag"
)
end
diff --git a/spec/bundler/runtime/gem_tasks_spec.rb b/spec/bundler/runtime/gem_tasks_spec.rb
index 9d673bb9cc..a81eaf5468 100644
--- a/spec/bundler/runtime/gem_tasks_spec.rb
+++ b/spec/bundler/runtime/gem_tasks_spec.rb
@@ -15,7 +15,6 @@ RSpec.describe "require 'bundler/gem_tasks'" do
bundled_app("Rakefile").open("w") do |f|
f.write <<-RAKEFILE
- $:.unshift("#{lib_dir}")
require "bundler/gem_tasks"
RAKEFILE
end
@@ -28,8 +27,8 @@ RSpec.describe "require 'bundler/gem_tasks'" do
end
it "includes the relevant tasks" do
- with_gem_path_as(Spec::Path.base_system_gems.to_s) do
- sys_exec "#{rake} -T", :env => { "RUBYOPT" => opt_add("-I#{lib_dir}", ENV["RUBYOPT"]) }
+ with_gem_path_as(base_system_gems.to_s) do
+ sys_exec "#{rake} -T", :env => { "GEM_HOME" => system_gem_path.to_s }
end
expect(err).to be_empty
@@ -46,8 +45,8 @@ RSpec.describe "require 'bundler/gem_tasks'" do
end
it "defines a working `rake install` task" do
- with_gem_path_as(Spec::Path.base_system_gems.to_s) do
- sys_exec "#{rake} install", :env => { "RUBYOPT" => opt_add("-I#{lib_dir}", ENV["RUBYOPT"]) }
+ with_gem_path_as(base_system_gems.to_s) do
+ sys_exec "#{rake} install", :env => { "GEM_HOME" => system_gem_path.to_s }
end
expect(err).to be_empty
@@ -69,9 +68,27 @@ RSpec.describe "require 'bundler/gem_tasks'" do
end
end
+ context "bundle path configured locally" do
+ before do
+ bundle "config set path vendor/bundle"
+ end
+
+ it "works" do
+ install_gemfile! <<-G
+ source "#{file_uri_for(gem_repo1)}"
+
+ gem "rake"
+ G
+
+ bundle! "exec rake -T"
+
+ expect(err).to be_empty
+ end
+ end
+
it "adds 'pkg' to rake/clean's CLOBBER" do
- with_gem_path_as(Spec::Path.base_system_gems.to_s) do
- sys_exec! %(#{rake} -e 'load "Rakefile"; puts CLOBBER.inspect')
+ with_gem_path_as(base_system_gems.to_s) do
+ sys_exec! %(#{rake} -e 'load "Rakefile"; puts CLOBBER.inspect'), :env => { "GEM_HOME" => system_gem_path.to_s }
end
expect(out).to eq '["pkg"]'
end
diff --git a/spec/bundler/runtime/setup_spec.rb b/spec/bundler/runtime/setup_spec.rb
index 5975218c48..c16515147e 100644
--- a/spec/bundler/runtime/setup_spec.rb
+++ b/spec/bundler/runtime/setup_spec.rb
@@ -767,13 +767,11 @@ end
G
ruby <<-R
- if Gem::Specification.method_defined? :extension_dir
- s = Gem::Specification.find_by_name '#{gem_name}'
- s.extension_dir = '#{ext_dir}'
+ s = Gem::Specification.find_by_name '#{gem_name}'
+ s.extension_dir = '#{ext_dir}'
- # Don't build extensions.
- s.class.send(:define_method, :build_extensions) { nil }
- end
+ # Don't build extensions.
+ s.class.send(:define_method, :build_extensions) { nil }
require '#{lib_dir}/bundler'
gem '#{gem_name}'