diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-11-28 12:18:40 +0100 |
---|---|---|
committer | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-11-28 15:37:18 +0100 |
commit | 9bac88a953902e2f4e73ac4650a9692f2c03b172 (patch) | |
tree | dac20914a48dc1ed5267851612d553fee3b54487 /spec | |
parent | c3eae8ea436af06ab2c3f4bdd25bd9dd6e7c9eef (diff) | |
download | bundler-9bac88a953902e2f4e73ac4650a9692f2c03b172.tar.gz |
Always pass env as strings to helpers
Diffstat (limited to 'spec')
-rw-r--r-- | spec/bundler/definition_spec.rb | 10 | ||||
-rw-r--r-- | spec/bundler/friendly_errors_spec.rb | 2 | ||||
-rw-r--r-- | spec/commands/binstubs_spec.rb | 2 | ||||
-rw-r--r-- | spec/commands/install_spec.rb | 2 | ||||
-rw-r--r-- | spec/install/deploy_spec.rb | 2 | ||||
-rw-r--r-- | spec/install/gemfile/path_spec.rb | 6 | ||||
-rw-r--r-- | spec/install/gems/compact_index_spec.rb | 2 | ||||
-rw-r--r-- | spec/install/gems/resolving_spec.rb | 6 | ||||
-rw-r--r-- | spec/install/gems/sudo_spec.rb | 2 | ||||
-rw-r--r-- | spec/runtime/setup_spec.rb | 10 | ||||
-rw-r--r-- | spec/support/helpers.rb | 2 |
11 files changed, 22 insertions, 24 deletions
diff --git a/spec/bundler/definition_spec.rb b/spec/bundler/definition_spec.rb index 92f836299d..1f4c1a0807 100644 --- a/spec/bundler/definition_spec.rb +++ b/spec/bundler/definition_spec.rb @@ -46,7 +46,7 @@ RSpec.describe Bundler::Definition do s.add_dependency "rack", "1.0" end - bundle :install, :env => { "DEBUG" => 1 } + bundle :install, :env => { "DEBUG" => "1" } expect(out).to match(/re-resolving dependencies/) lockfile_should_be <<-G @@ -84,7 +84,7 @@ RSpec.describe Bundler::Definition do s.add_dependency "rack", "1.0" end - bundle :install, :env => { "DEBUG" => 1 } + bundle :install, :env => { "DEBUG" => "1" } expect(out).to match(/re-resolving dependencies/) lockfile_should_be <<-G @@ -121,7 +121,7 @@ RSpec.describe Bundler::Definition do gem "foo", :path => "#{lib_path("foo")}" G - bundle :check, :env => { "DEBUG" => 1 } + bundle :check, :env => { "DEBUG" => "1" } expect(out).to match(/using resolution from the lockfile/) lockfile_should_be <<-G @@ -154,7 +154,7 @@ RSpec.describe Bundler::Definition do G bundle "lock --add-platform java" - bundle :check, :env => { "DEBUG" => 1 } + bundle :check, :env => { "DEBUG" => "1" } expect(out).to match(/using resolution from the lockfile/) lockfile_should_be <<-G @@ -181,7 +181,7 @@ RSpec.describe Bundler::Definition do gem "foo" G - bundle :check, :env => { "DEBUG" => 1 } + bundle :check, :env => { "DEBUG" => "1" } expect(out).to match(/using resolution from the lockfile/) lockfile_should_be <<-G diff --git a/spec/bundler/friendly_errors_spec.rb b/spec/bundler/friendly_errors_spec.rb index 47e7a5d3cd..e9189b0514 100644 --- a/spec/bundler/friendly_errors_spec.rb +++ b/spec/bundler/friendly_errors_spec.rb @@ -22,7 +22,7 @@ RSpec.describe Bundler, "friendly errors" do gem "rack" G - bundle :install, :env => { "DEBUG" => true } + bundle :install, :env => { "DEBUG" => "true" } expect(err).to include("Failed to load #{home(".gemrc")}") expect(exitstatus).to eq(0) if exitstatus diff --git a/spec/commands/binstubs_spec.rb b/spec/commands/binstubs_spec.rb index df10bd3498..7c04e8ddbd 100644 --- a/spec/commands/binstubs_spec.rb +++ b/spec/commands/binstubs_spec.rb @@ -458,7 +458,7 @@ RSpec.describe "bundle binstubs <gem>" do G bundle "config set auto_install 1" - bundle "binstubs rack", :env => { "BUNDLE_INSTALL" => 1 } + bundle "binstubs rack", :env => { "BUNDLE_INSTALL" => "1" } expect(out).not_to include("Installing rack 1.0.0") end end diff --git a/spec/commands/install_spec.rb b/spec/commands/install_spec.rb index 8e161a4aae..b57d81b10a 100644 --- a/spec/commands/install_spec.rb +++ b/spec/commands/install_spec.rb @@ -45,7 +45,7 @@ RSpec.describe "bundle install with gem sources" do gem "rack" G - bundle! :install, :env => { "BUNDLE_PATH__SYSTEM" => true } # can't use install_gemfile since it sets retry + bundle! :install, :env => { "BUNDLE_PATH__SYSTEM" => "true" } # can't use install_gemfile since it sets retry expect(bundled_app(".bundle")).not_to exist end diff --git a/spec/install/deploy_spec.rb b/spec/install/deploy_spec.rb index d607f8bb46..89da3fc801 100644 --- a/spec/install/deploy_spec.rb +++ b/spec/install/deploy_spec.rb @@ -146,7 +146,7 @@ RSpec.describe "install with --deployment or --frozen" do expect(the_bundle).to include_gems "path_gem 1.0" FileUtils.rm_r lib_path("path_gem-1.0") - bundle! :install, forgotten_command_line_options(:path => ".bundle", :without => "development", :deployment => true).merge(:env => { :DEBUG => "1" }) + bundle! :install, forgotten_command_line_options(:path => ".bundle", :without => "development", :deployment => true).merge(:env => { "DEBUG" => "1" }) run! "puts :WIN" expect(out).to eq("WIN") end diff --git a/spec/install/gemfile/path_spec.rb b/spec/install/gemfile/path_spec.rb index 4176ee9f70..b21c08ec92 100644 --- a/spec/install/gemfile/path_spec.rb +++ b/spec/install/gemfile/path_spec.rb @@ -438,7 +438,7 @@ RSpec.describe "bundle install with explicit source paths" do gem 'net-ssh', '1.0' G - bundle :check, :env => { "DEBUG" => 1 } + bundle :check, :env => { "DEBUG" => "1" } expect(out).to match(/using resolution from the lockfile/) expect(the_bundle).to include_gems "rack-obama 1.0", "net-ssh 1.0" end @@ -458,7 +458,7 @@ RSpec.describe "bundle install with explicit source paths" do gem 'net-ssh', :path => "#{lib_path("omg")}" G - bundle :check, :env => { "DEBUG" => 1 } + bundle :check, :env => { "DEBUG" => "1" } expect(out).to match(/using resolution from the lockfile/) expect(the_bundle).to include_gems "rack-obama 1.0", "net-ssh 1.0" end @@ -653,7 +653,7 @@ RSpec.describe "bundle install with explicit source paths" do File.open(lib_path("private_lib/Gemfile"), "w") {|f| f.puts gemfile } Dir.chdir(lib_path("private_lib")) do - bundle :install, :env => { "DEBUG" => 1 }, :artifice => "endpoint" + bundle :install, :env => { "DEBUG" => "1" }, :artifice => "endpoint" expect(out).to match(%r{^HTTP GET http://localgemserver\.test/api/v1/dependencies\?gems=rack$}) expect(out).not_to match(/^HTTP GET.*private_lib/) expect(the_bundle).to include_gems "private_lib 2.2" diff --git a/spec/install/gems/compact_index_spec.rb b/spec/install/gems/compact_index_spec.rb index 2c145ce643..a294b83d1c 100644 --- a/spec/install/gems/compact_index_spec.rb +++ b/spec/install/gems/compact_index_spec.rb @@ -51,7 +51,7 @@ RSpec.describe "compact index api" do build_gem "Rack", "0.1" end - install_gemfile! <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4 } + install_gemfile! <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } source "#{source_uri}" gem "rack", "1.0" gem "Rack", "0.1" diff --git a/spec/install/gems/resolving_spec.rb b/spec/install/gems/resolving_spec.rb index f7c72d7e31..52511ff67f 100644 --- a/spec/install/gems/resolving_spec.rb +++ b/spec/install/gems/resolving_spec.rb @@ -108,7 +108,7 @@ RSpec.describe "bundle install with install-time dependencies" do end end - install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2 } + install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } ruby "#{RUBY_VERSION}" source "http://localgemserver.test/" gem 'rack' @@ -127,7 +127,7 @@ RSpec.describe "bundle install with install-time dependencies" do build_gem "foo1", "1.0" end - install_gemfile <<-G, :artifice => "compact_index_rate_limited", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4 } + install_gemfile <<-G, :artifice => "compact_index_rate_limited", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } ruby "#{RUBY_VERSION}" source "http://localgemserver.test/" gem 'rack' @@ -153,7 +153,7 @@ RSpec.describe "bundle install with install-time dependencies" do shared_examples_for "ruby version conflicts" do it "raises an error during resolution" do - install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2 } + install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } source "http://localgemserver.test/" ruby #{ruby_requirement} gem 'require_ruby' diff --git a/spec/install/gems/sudo_spec.rb b/spec/install/gems/sudo_spec.rb index fcafe4a907..170ffaca03 100644 --- a/spec/install/gems/sudo_spec.rb +++ b/spec/install/gems/sudo_spec.rb @@ -172,7 +172,7 @@ RSpec.describe "when using sudo", :sudo => true do context "when ENV['BUNDLE_SILENCE_ROOT_WARNING'] is set" do it "skips the warning" do - bundle :install, :sudo => :preserve_env, :env => { "BUNDLE_SILENCE_ROOT_WARNING" => true } + bundle :install, :sudo => :preserve_env, :env => { "BUNDLE_SILENCE_ROOT_WARNING" => "true" } expect(err).to_not include(warning) end end diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb index e247feb804..24f3803f3c 100644 --- a/spec/runtime/setup_spec.rb +++ b/spec/runtime/setup_spec.rb @@ -864,7 +864,7 @@ end G Dir.chdir(bundled_app.parent) do - run <<-R, :env => { "BUNDLE_GEMFILE" => bundled_app("Gemfile") } + run <<-R, :env => { "BUNDLE_GEMFILE" => bundled_app("Gemfile").to_s } require 'foo' R end @@ -888,7 +888,7 @@ end bundle :install Dir.chdir(bundled_app.parent) do - run <<-R, :env => { "BUNDLE_GEMFILE" => bundled_app("Gemfile") } + run <<-R, :env => { "BUNDLE_GEMFILE" => bundled_app("Gemfile").to_s } require 'foo' R end @@ -1246,14 +1246,14 @@ end it "activates no gems with -rbundler/setup" do install_gemfile! "" - ruby! code, :env => { :RUBYOPT => activation_warning_hack_rubyopt + " -r#{lib_dir}/bundler/setup" } + ruby! code, :env => { "RUBYOPT" => activation_warning_hack_rubyopt + " -r#{lib_dir}/bundler/setup" } expect(out).to eq("{}") end it "activates no gems with bundle exec" do install_gemfile! "" create_file("script.rb", code) - bundle! "exec ruby ./script.rb", :env => { :RUBYOPT => activation_warning_hack_rubyopt } + bundle! "exec ruby ./script.rb", :env => { "RUBYOPT" => activation_warning_hack_rubyopt } expect(out).to eq("{}") end @@ -1261,7 +1261,7 @@ end install_gemfile! "" create_file("script.rb", "#!/usr/bin/env ruby\n\n#{code}") FileUtils.chmod(0o777, bundled_app("script.rb")) - bundle! "exec ./script.rb", :artifice => nil, :env => { :RUBYOPT => activation_warning_hack_rubyopt } + bundle! "exec ./script.rb", :artifice => nil, :env => { "RUBYOPT" => activation_warning_hack_rubyopt } expect(out).to eq("{}") end diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index 95c2d60d56..1290b46a53 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -207,8 +207,6 @@ module Spec def sys_exec(cmd, env = {}) command_execution = CommandExecution.new(cmd.to_s, Dir.pwd) - env = env.map {|k, v| [k.to_s, v.to_s] }.to_h # convert env keys and values to string - require "open3" Open3.popen3(env, cmd.to_s) do |stdin, stdout, stderr, wait_thr| yield stdin, stdout, wait_thr if block_given? |