Class: Jstdutil::TestRunner
- Inherits:
-
Object
- Object
- Jstdutil::TestRunner
- Defined in:
- lib/jstdutil/test_runner.rb
Instance Method Summary collapse
- #finalize ⇒ Object
-
#initialize(args = []) ⇒ TestRunner
constructor
A new instance of TestRunner.
- #run(tests = "all") ⇒ Object
- #test_cases(files) ⇒ Object
Constructor Details
#initialize(args = []) ⇒ TestRunner
Returns a new instance of TestRunner.
8 9 10 11 12 13 |
# File 'lib/jstdutil/test_runner.rb', line 8 def initialize(args = []) @args = strip_opt(args.join(" "), "tests") config = guess_config rescue StandardError => err raise err end |
Instance Method Details
#finalize ⇒ Object
33 34 |
# File 'lib/jstdutil/test_runner.rb', line 33 def finalize end |
#run(tests = "all") ⇒ Object
28 29 30 31 |
# File 'lib/jstdutil/test_runner.rb', line 28 def run(tests = "all") puts(Time.now.strftime("%F %H:%M:%S Running #{tests}")) puts(Jstdutil::Cli.run(args("tests" => tests))) end |
#test_cases(files) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/jstdutil/test_runner.rb', line 15 def test_cases(files) files = files.respond_to?(:captures) ? files.captures : files @args = @args.sub(/--reset\s*/, "") cases = files.collect do |file| @args = @args.sub(/(\s*--reset)?$/, " --reset") if file !~ /_test\.js$/ TestFile.new(file).test_cases end.flatten.reject { |tc| tc.nil? }.map { |tc| tc.index(" ").nil? ? tc : "\"#{tc}\"" }.join(",") cases == "" && "all" || cases end |