summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2020-01-12 15:38:55 +0100
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2020-01-12 16:31:07 +0100
commit544e57cbe9bccd4f6e85c2ccea7e8d4a8c0f59fa (patch)
treeb7f371d5f43955ad84b46a9c44285e1c6fbc9500
parent7c1e5152b19010c95fbbfb62ddfdd753911d94b3 (diff)
downloadbundler-544e57cbe9bccd4f6e85c2ccea7e8d4a8c0f59fa.tar.gz
Pass a generic options hash to `sys_exec`
For consistency with the rest of helpers.
-rw-r--r--spec/commands/binstubs_spec.rb2
-rw-r--r--spec/commands/newgem_spec.rb2
-rw-r--r--spec/runtime/gem_tasks_spec.rb4
-rw-r--r--spec/runtime/setup_spec.rb2
-rw-r--r--spec/support/helpers.rb8
5 files changed, 9 insertions, 9 deletions
diff --git a/spec/commands/binstubs_spec.rb b/spec/commands/binstubs_spec.rb
index 0c86e4cdb6..1d84b16524 100644
--- a/spec/commands/binstubs_spec.rb
+++ b/spec/commands/binstubs_spec.rb
@@ -137,7 +137,7 @@ RSpec.describe "bundle binstubs <gem>" do
context "when BUNDLER_VERSION is set" do
it "runs the correct version of bundler" do
- sys_exec "#{bundled_app("bin/bundle")} install", "BUNDLER_VERSION" => "999.999.999"
+ sys_exec "#{bundled_app("bin/bundle")} install", :env => { "BUNDLER_VERSION" => "999.999.999" }
expect(exitstatus).to eq(42) if exitstatus
expect(err).to include("Activating bundler (~> 999.999) failed:").
and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'`")
diff --git a/spec/commands/newgem_spec.rb b/spec/commands/newgem_spec.rb
index 0bdf8ecba8..13d1e7abd7 100644
--- a/spec/commands/newgem_spec.rb
+++ b/spec/commands/newgem_spec.rb
@@ -232,7 +232,7 @@ RSpec.describe "bundle gem" do
load_paths = [lib_dir, spec_dir]
load_path_str = "-I#{load_paths.join(File::PATH_SEPARATOR)}"
- sys_exec! "#{Gem.ruby} #{load_path_str} #{bindir.join("bundle")} gem #{gem_name}", "PATH" => ""
+ sys_exec! "#{Gem.ruby} #{load_path_str} #{bindir.join("bundle")} gem #{gem_name}", :env => { "PATH" => "" }
end
it "creates the gem without the need for git" do
diff --git a/spec/runtime/gem_tasks_spec.rb b/spec/runtime/gem_tasks_spec.rb
index f85f364865..91ea5cf189 100644
--- a/spec/runtime/gem_tasks_spec.rb
+++ b/spec/runtime/gem_tasks_spec.rb
@@ -29,7 +29,7 @@ RSpec.describe "require 'bundler/gem_tasks'" do
it "includes the relevant tasks" do
with_gem_path_as(Spec::Path.base_system_gems.to_s) do
- sys_exec "#{rake} -T", "RUBYOPT" => "-I#{lib_dir}"
+ sys_exec "#{rake} -T", :env => { "RUBYOPT" => "-I#{lib_dir}" }
end
expect(err).to be_empty
@@ -47,7 +47,7 @@ RSpec.describe "require 'bundler/gem_tasks'" do
it "defines a working `rake install` task" do
with_gem_path_as(Spec::Path.base_system_gems.to_s) do
- sys_exec "#{rake} install", "RUBYOPT" => "-I#{lib_dir}"
+ sys_exec "#{rake} install", :env => { "RUBYOPT" => "-I#{lib_dir}" }
end
expect(err).to be_empty
diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb
index 7ffddbd151..8c2c55ac5b 100644
--- a/spec/runtime/setup_spec.rb
+++ b/spec/runtime/setup_spec.rb
@@ -1375,7 +1375,7 @@ end
end
it "takes care of requiring rubygems" do
- sys_exec("#{Gem.ruby} -I#{lib_dir} -e \"puts require('bundler/setup')\"", "RUBYOPT" => "--disable=gems")
+ sys_exec("#{Gem.ruby} -I#{lib_dir} -e \"puts require('bundler/setup')\"", :env => { "RUBYOPT" => "--disable=gems" })
expect(last_command.stdboth).to eq("true")
end
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index fe142e62d9..4180a2f1ae 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -128,7 +128,7 @@ module Spec
end.join
cmd = "#{sudo} #{Gem.ruby} #{load_path_str} #{requires_str} #{bundle_bin} #{cmd}#{args}"
- sys_exec(cmd, env, &block)
+ sys_exec(cmd, { :env => env }, &block)
end
bang :bundle
@@ -155,9 +155,8 @@ module Spec
end
def ruby(ruby, options = {})
- env = options.delete(:env) || {}
lib_option = options[:no_lib] ? "" : " -I#{lib_dir}"
- sys_exec(%(#{Gem.ruby}#{lib_option} -w -e #{ruby.shellescape}), env)
+ sys_exec(%(#{Gem.ruby}#{lib_option} -w -e #{ruby.shellescape}), options)
end
bang :ruby
@@ -189,7 +188,8 @@ module Spec
"#{Gem.ruby} -S #{ENV["GEM_PATH"]}/bin/rake"
end
- def sys_exec(cmd, env = {})
+ def sys_exec(cmd, options = {})
+ env = options[:env] || {}
command_execution = CommandExecution.new(cmd.to_s, Dir.pwd)
require "open3"