lib/testrbl.rb in testrbl-0.3.3 vs lib/testrbl.rb in testrbl-0.4.0

- old
+ new

@@ -21,11 +21,12 @@ line = $2 run(ruby + load_options + [file, "-n", "/#{pattern_from_file(File.readlines(file), line)}/"] + options) else if files.size == 1 and File.file?(files.first) run(ruby + load_options + files + options) - elsif files.all? { |f| File.file?(f) } and options.none? { |arg| arg =~ /^-n/ } + elsif options.none? { |arg| arg =~ /^-n/ } + files = files.map { |f| File.directory?(f) ? all_test_files_in(f) : f }.flatten run(ruby + load_options + files.map { |f| "-r#{f}" } + options + ["-e", ""]) else # pass though # no bundle exec: projects with mini and unit-test do not run well via bundle exec testrb run ["testrb"] + argv end @@ -54,9 +55,13 @@ found_final = 0 patterns.reject { |p| p.end_with?("$") and (found_final += 1) > 1 } end private + + def self.all_test_files_in(folder) + Dir[File.join(folder, "{**/,}*_{test,spec}.rb")] + end def self.partition_options(options) next_is_before = false options.partition do |option| if next_is_before