From a11fab43cbd84cfce84ac35e2a831ca0cc28c1bd Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Wed, 24 May 2017 16:29:17 -0400 Subject: [PATCH] Update spec task to preserve simplecov coverage info for previous full spec runs when doing a partial spec run --- Rakefile.rb | 1 + spec/build_tests_spec.rb | 8 +++++++- spec/spec_helper.rb | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Rakefile.rb b/Rakefile.rb index 2b47783..9c69011 100644 --- a/Rakefile.rb +++ b/Rakefile.rb @@ -15,6 +15,7 @@ CLOBBER.include %w[pkg] RSpec::Core::RakeTask.new(:spec, :example_string) do |task, args| if args.example_string + ENV["partial_specs"] = "1" task.rspec_opts = %W[-e "#{args.example_string}" -f documentation] end end diff --git a/spec/build_tests_spec.rb b/spec/build_tests_spec.rb index db468ee..dee85de 100644 --- a/spec/build_tests_spec.rb +++ b/spec/build_tests_spec.rb @@ -65,7 +65,13 @@ describe Rscons do command = %W[ruby -I. -r _simplecov_setup #{@owd}/bin/rscons] + rsconsfile_args + rscons_args @statics[:build_test_id] ||= 0 @statics[:build_test_id] += 1 - command_name = "b#{@statics[:build_test_id]}" + command_prefix = + if ENV["partial_specs"] + "p" + else + "b" + end + command_name = "#{command_prefix}#{@statics[:build_test_id]}" File.open("_simplecov_setup.rb", "w") do |fh| fh.puts <