lib/testr/config.rb in testr-14.1.0 vs lib/testr/config.rb in testr-14.1.1
- old
+ new
@@ -44,17 +44,19 @@
Config.after_fork_hooks = [
# tell testing framework to only run the named tests inside the test file
lambda do |worker_number, log_file, test_file, test_names|
unless test_names.empty?
- regexp = test_names.map {|name|
- # sanitize string interpolations and invalid method name characters
- name.gsub(/\#\{.*?\}/, ' ').strip.gsub(/\W+/, '.*')
- }.join('|')
-
case File.basename(test_file)
- when /(\b|_)test(\b|_)/ then ARGV.push '--name', "/#{regexp}/"
- when /(\b|_)spec(\b|_)/ then ARGV.push '--example', regexp.source
+ when /(\b|_)test(\b|_)/ # Test::Unit
+ ARGV.push '--name', "/(?i:#{
+ test_names.map do |name|
+ # elide string interpolation and invalid method name characters
+ name.gsub(/\#\{.*?\}/, ' ').strip.gsub(/\W+/, '.*')
+ end.join('|')
+ })/"
+ when /(\b|_)spec(\b|_)/ # RSpec
+ test_names.each {|name| ARGV.push '--example', name }
end
end
end
]