Sha256: bc88d5914a504aad73e6020aacf82a989dcce841716f5ba6d66db514cb9ed7df
Contents?: true
Size: 1.26 KB
Versions: 2
Compression:
Stored size: 1.26 KB
Contents
require 'guard/notifier' require 'open3' module Guard class JasmineHeadlessWebkitRunner class << self def run(paths = []) lines = [""] Open3.popen3(%{jasmine-headless-webkit -c #{paths.join(" ")}}) do |stdin, stdout, stderr| stdin.close stderr.close while !stdout.eof? $stdout.print (char = stdout.getc) $stdout.flush if char.chr == "\n" lines << "" else lines.last << char.chr end end end total, fails, secs = lines[-2].scan(%r{.* (\d+) tests, (\d+) failures, (.+) secs..*}).flatten any_console = lines.any? { |line| line['[console] '] } Notifier.notify(message(total, fails, secs, any_console), :title => 'Jasmine results', :image => image(any_console, fails)) fails.to_i end private def message(total, fails, secs, any_console) "#{total} tests, #{fails} failures, #{secs} secs#{any_console ? ', console.log used' : ''}." end def image(any_console, fails) if any_console :pending else if fails.to_i == 0 :success else :failed end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
guard-jasmine-headless-webkit-0.0.4 | lib/guard/jasmine-headless-webkit/runner.rb |
guard-jasmine-headless-webkit-0.0.3 | lib/guard/jasmine-headless-webkit/runner.rb |