summaryrefslogtreecommitdiff
path: root/spec/bundler/runtime
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/bundler/runtime
parent93ebf9643dc0913693157e6b4bb391a549a9b8ae (diff)
Sync Bundler PR #3624 with HEAD commits
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3114
Diffstat (limited to 'spec/bundler/runtime')
-rw-r--r--spec/bundler/runtime/gem_tasks_spec.rb31
-rw-r--r--spec/bundler/runtime/setup_spec.rb10
2 files changed, 28 insertions, 13 deletions
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}'