Class: Jaspec::Runner
- Inherits:
-
Object
- Object
- Jaspec::Runner
- Defined in:
- lib/jaspec/runner.rb
Constant Summary collapse
- PHANTOM_RUNNER =
File.('runner/phantom.js', File.dirname(__FILE__))
- HTML_RUNNER =
File.('runner/runner.html', File.dirname(__FILE__))
Class Method Summary collapse
Class Method Details
.run(spec) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/jaspec/runner.rb', line 8 def run(spec) if spec.kind_of?(Array) || File.directory?(spec) run_all(spec) else system("phantomjs #{PHANTOM_RUNNER} #{HTML_RUNNER} #{spec}") end end |
.run_all(specs) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/jaspec/runner.rb', line 16 def run_all(specs) failures = [] unless specs.kind_of?(Array) specs = Dir.glob(File.join(specs,'**','*Spec.{js,coffee}')) end specs.each do |spec| failures << spec if !run(spec) end if failures.empty? puts "\nAll specs passing. Badass!" return true else puts "\n#{failures.length} failing spec file#{'s' if failures.length > 1}:" puts failures.map{|f|"\033[31m- #{f}\033[0m"}.join("\n") return false end end |