summaryrefslogtreecommitdiff
path: root/spec/spec_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r--spec/spec_helper.rb15
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