From daff1cc98cc1dbd39063b71f1636c863c4f8dcb5 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Tue, 12 Nov 2019 14:04:06 +0000 Subject: [PATCH] Merge #7422 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 7422: Turn on warning mode for specs r=deivid-rodriguez a=deivid-rodriguez ### What was the end-user problem that led to this PR? The problem was that we're missing verbose warnings like the one fixed by #7417. ### What was your diagnosis of the problem? My diagnosis was that our specs should let us know about this. ### What is your fix for the problem, implemented in this PR? My fix is to enable warnings from our helpers that shell out, and fix the warnings they print. There's also some unrelated changes here that I'll try to split out once I get this green. ### Why did you choose this fix out of the possible options? I chose this fix because it makes it so that our specs help us catching these warnings earlier. Co-authored-by: David Rodríguez (cherry picked from commit 4244534ee9acb6e345fb9066df568f50419ef8f7) --- spec/runtime/inline_spec.rb | 5 ++--- spec/runtime/setup_spec.rb | 2 ++ spec/support/helpers.rb | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/spec/runtime/inline_spec.rb b/spec/runtime/inline_spec.rb index 06be2ef83d5..afb9c3d180c 100644 --- a/spec/runtime/inline_spec.rb +++ b/spec/runtime/inline_spec.rb @@ -5,7 +5,7 @@ def script(code, options = {}) requires = ["#{lib_dir}/bundler/inline"] requires.unshift "#{spec_dir}/support/artifice/" + options.delete(:artifice) if options.key?(:artifice) requires = requires.map {|r| "require '#{r}'" }.join("\n") - @out = ruby("#{requires}\n\n" + code, options) + ruby("#{requires}\n\n" + code, options) end before :each do @@ -88,9 +88,8 @@ def script(code, options = {}) RUBY expect(out).to include("Installing activesupport") - err.gsub! %r{(.*lib/sinatra/base\.rb:\d+: warning: constant ::Fixnum is deprecated$)}, "" err_lines = err.split("\n") - err_lines.reject!{|line| line =~ /\.rb:\d+: warning: / } + err_lines.reject!{|line| line =~ /\.rb:\d+: warning: / } unless RUBY_VERSION < "2.7" expect(err_lines).to be_empty expect(exitstatus).to be_zero if exitstatus end diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb index 4a754945b75..d86d1320eab 100644 --- a/spec/runtime/setup_spec.rb +++ b/spec/runtime/setup_spec.rb @@ -1027,6 +1027,8 @@ def clean_load_path(lp) ruby <<-RUBY require '#{lib_dir}/bundler' + bundler_module = class << Bundler; self; end + bundler_module.send(:remove_method, :require) def Bundler.require(path) raise "LOSE" end diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index 911f734d8b4..d085b769d73 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -174,7 +174,7 @@ def ruby(ruby, options = {}) env = options.delete(:env) || {} ruby = ruby.gsub(/["`\$]/) {|m| "\\#{m}" } lib_option = options[:no_lib] ? "" : " -I#{lib_dir}" - sys_exec(%(#{Gem.ruby}#{lib_option} -e "#{ruby}"), env) + sys_exec(%(#{Gem.ruby}#{lib_option} -w -e "#{ruby}"), env) end bang :ruby