lib/simplecov/command_guesser.rb in simplecov-0.8.0.pre vs lib/simplecov/command_guesser.rb in simplecov-0.8.0.pre2
- old
+ new
@@ -9,13 +9,22 @@
# between rails unit/functional/integration tests impossible without this cached
# item.
attr_accessor :original_run_command
def guess
- from_command_line_options || from_defined_constants
+ from_env || from_command_line_options || from_defined_constants
end
private
+
+ def from_env
+ # If being run from inside parallel_tests set the command name according to the process number
+ if ENV['PARALLEL_TEST_GROUPS'] && ENV['TEST_ENV_NUMBER']
+ number = ENV['TEST_ENV_NUMBER']
+ number = '1' if number == ''
+ "(#{number}/#{ENV['PARALLEL_TEST_GROUPS']})"
+ end
+ end
def from_command_line_options
case original_run_command
when /test\/functional\//, /test\/{.*?functional.*?}\//
"Functional Tests"