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-27 13:03:22 +0200 |
commit | fabb93a5dee650acb8d51e2766ace03e9da6fb35 (patch) | |
tree | bafb7fa50a9ecb39841543a5cedd2430800b15ac | |
parent | 4acd7dd62f367789c0f09c0fbff68e28e2ededf7 (diff) | |
download | bundler-random_test_order.tar.gz |
Fix bisectionsrandom_test_order
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 29b292968d..d3de1ff784 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 |