From 33cca669cc24979e6abcdbd1c1d165f364d8c90c Mon Sep 17 00:00:00 2001 From: Alexander Riccio Date: Thu, 6 Jun 2019 13:07:08 -0400 Subject: [PATCH] prototype option to run rspec with ruby warnings enabled --- bin/learn-test | 4 ++++ lib/learn_test/strategies/rspec.rb | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/bin/learn-test b/bin/learn-test index 3cf2a4c..5230a06 100755 --- a/bin/learn-test +++ b/bin/learn-test @@ -61,6 +61,10 @@ OptionParser.new do |opts| (options[:example] ||= []) << s end + opts.on("-w", "--run-rspec-with-ruby-warnings-on", "Runs RSpec with Ruby warnings enabled ('-w')") do |w| + options[:ruby_warnings] = w + end + if ARGV.any? { |arg| arg == "init" } options[:init] = true end diff --git a/lib/learn_test/strategies/rspec.rb b/lib/learn_test/strategies/rspec.rb index 2ab1cd6..b711d9e 100644 --- a/lib/learn_test/strategies/rspec.rb +++ b/lib/learn_test/strategies/rspec.rb @@ -25,6 +25,10 @@ def configure argv << '--fail-fast' end + if warning_option_present? + argv << '-w' + end + if example_option_present? argv << options[:example].map{|e| "--example #{e}"}.join(" ") end @@ -91,6 +95,10 @@ def example_option_present? options[:example] end + def warning_option_present? + options[:ruby_warnings] + end + def dot_rspec @dot_rspec ||= File.readlines('.rspec').map(&:strip) if File.exist?('.rspec') end