diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2019-06-01 12:49:40 +0300 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2019-06-09 12:44:10 +0900 |
commit | 8f37629519ad330032a38ac0e871b2912ed38a1b (patch) | |
tree | bb0529b77583d47993d8b0d608d68896aa3a5298 /spec/bundler/spec_helper.rb | |
parent | 66508992483ae5d77b56a98427c50c772341c0ac (diff) | |
download | ruby-8f37629519ad330032a38ac0e871b2912ed38a1b.tar.gz |
Merge bundler master from upstream.
Pick from 8dd59e3ba97eb80a599f8149f31bf40773b69dc0
Diffstat (limited to 'spec/bundler/spec_helper.rb')
-rw-r--r-- | spec/bundler/spec_helper.rb | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/spec/bundler/spec_helper.rb b/spec/bundler/spec_helper.rb index e8e7cc9a1f..d3de1ff784 100644 --- a/spec/bundler/spec_helper.rb +++ b/spec/bundler/spec_helper.rb @@ -23,14 +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" - -Spec::CodeClimate.setup module Gem def self.ruby=(ruby) @@ -60,6 +52,8 @@ RSpec.configure do |config| # forever due to memory constraints config.fail_fast ||= 25 if ENV["CI"] + config.bisect_runner = :shell + if ENV["BUNDLER_SUDO_TESTS"] && Spec::Sudo.present? config.filter_run :sudo => true else @@ -72,8 +66,11 @@ RSpec.configure do |config| config.filter_run_excluding :realworld => true end + git_version = Bundler::Source::Git::GitProxy.new(nil, nil, nil).version + config.filter_run_excluding :ruby => RequirementChecker.against(RUBY_VERSION) config.filter_run_excluding :rubygems => RequirementChecker.against(Gem::VERSION) + config.filter_run_excluding :git => RequirementChecker.against(git_version) config.filter_run_excluding :rubygems_master => (ENV["RGV"] != "master") config.filter_run_excluding :bundler => RequirementChecker.against(Bundler::VERSION.split(".")[0]) config.filter_run_excluding :ruby_repo => !(ENV["BUNDLE_RUBY"] && ENV["BUNDLE_GEM"]).nil? @@ -101,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 @@ -110,14 +116,15 @@ RSpec.configure do |config| build_repo1 end - config.before :each do + config.around :each do |example| + ENV.replace(original_env) reset! system_gems [] in_app_root @command_executions = [] - end - config.after :each do |example| + example.run + all_output = @command_executions.map(&:to_s_verbose).join("\n\n") if example.exception && !all_output.empty? warn all_output unless config.formatters.grep(RSpec::Core::Formatters::DocumentationFormatter).empty? @@ -128,7 +135,6 @@ RSpec.configure do |config| end Dir.chdir(original_wd) - ENV.replace(original_env) end config.after :suite do |