diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-05-24 11:03:33 +0200 |
---|---|---|
committer | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-05-24 14:31:05 +0200 |
commit | dd80551be9fbb8ae8c26efa76e4ab5fbcc14dbdb (patch) | |
tree | 7b3949e1f67c116714adf8b2051d370254dd3767 | |
parent | 7a03745a97a662069db0a0dbfb2e76e3e47483db (diff) | |
download | bundler-fix_bisections.tar.gz |
Fix bisectionsfix_bisections
RSpec bisector needs to read the configuration, for example to find out
which kind of runner to use. So, it needs to load the spec helper. It
does that, though, before actually shelling out to run any tests. If we
modify the environment at the top level, that changes it before shelling
out and thus we fail to find RSpec in the subsequent subprocess.
So, instead of modifying the environment at the top level, we do it
lazily in the `before(:suite)` hook.
-rw-r--r-- | spec/spec_helper.rb | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e236a01ce1..b234a28fe8 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -23,12 +23,6 @@ end $debug = false Spec::Manpages.setup unless Gem.win_platform? -Spec::Rubygems.setup -ENV["RUBYOPT"] = "#{ENV["RUBYOPT"]} -r#{Spec::Path.spec_dir}/support/hax.rb" -ENV["BUNDLE_SPEC_RUN"] = "true" - -# Don't wrap output in tests -ENV["THOR_COLUMNS"] = "10000" module Gem def self.ruby=(ruby) @@ -104,6 +98,15 @@ RSpec.configure do |config| end config.before :suite do + Spec::Rubygems.setup + ENV["RUBYOPT"] = original_env["RUBYOPT"] = "#{ENV["RUBYOPT"]} -r#{Spec::Path.spec_dir}/support/hax.rb" + ENV["BUNDLE_SPEC_RUN"] = original_env["BUNDLE_SPEC_RUN"] = "true" + + # Don't wrap output in tests + ENV["THOR_COLUMNS"] = "10000" + + original_env = ENV.to_hash.delete_if {|k, _v| k.start_with?(Bundler::EnvironmentPreserver::BUNDLER_PREFIX) } + if ENV["BUNDLE_RUBY"] FileUtils.cp_r Spec::Path.bindir, File.join(Spec::Path.root, "lib", "exe") end |