update runner to use new reporting system
This commit is contained in:
parent
25816daf7f
commit
c467aea42b
|
@ -20,5 +20,6 @@ Gem::Specification.new do |s|
|
||||||
s.require_paths = ["lib"]
|
s.require_paths = ["lib"]
|
||||||
|
|
||||||
s.add_dependency 'guard', '>= 0.4.0'
|
s.add_dependency 'guard', '>= 0.4.0'
|
||||||
s.add_dependency 'jasmine-headless-webkit', '>= 0.3.0'
|
s.add_dependency 'jasmine-headless-webkit', '>= 0.7.0'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
require 'guard/notifier'
|
require 'guard/notifier'
|
||||||
require 'jasmine/headless/runner'
|
require 'jasmine-headless-webkit'
|
||||||
|
|
||||||
module Guard
|
module Guard
|
||||||
class JasmineHeadlessWebkitRunner
|
class JasmineHeadlessWebkitRunner
|
||||||
|
@ -14,14 +14,14 @@ module Guard
|
||||||
end
|
end
|
||||||
|
|
||||||
def notify(file)
|
def notify(file)
|
||||||
if (data = File.read(file).strip).empty?
|
if (report = Jasmine::Headless::Report.load(file)).valid?
|
||||||
Notifier.notify('Spec runner interrupted!', :title => 'Jasmine results', :image => :failed)
|
Notifier.notify(message(report.total, report.failed, report.time, report.has_used_console?), :title => 'Jasmine results', :image => image(report.has_used_console?, report.failed))
|
||||||
|
report.failed
|
||||||
else
|
else
|
||||||
total, fails, any_console, secs = data.lines.first.strip.split('/')
|
raise StandardError.new("invalid report")
|
||||||
|
|
||||||
Notifier.notify(message(total, fails, secs, any_console == "T"), :title => 'Jasmine results', :image => image(any_console == "T", fails))
|
|
||||||
fails.to_i
|
|
||||||
end
|
end
|
||||||
|
rescue Exception => e
|
||||||
|
Notifier.notify('Spec runner interrupted!', :title => 'Jasmine results', :image => :failed)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
module Guard
|
module Guard
|
||||||
module JasmineHeadlessWebkitVersion
|
module JasmineHeadlessWebkitVersion
|
||||||
VERSION = "0.2.1"
|
VERSION = "0.3.0"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,20 +13,20 @@ describe Guard::JasmineHeadlessWebkitRunner do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'system run not interrupted' do
|
context 'system run not interrupted' do
|
||||||
let(:data) { '1/0/F/5' }
|
let(:data) { 'TOTAL||1||0||5||F' }
|
||||||
|
|
||||||
it 'should notify with the right information' do
|
it 'should notify with the right information' do
|
||||||
Guard::Notifier.expects(:notify).with("1 test, 0 failures, 5 secs.", { :title => 'Jasmine results', :image => :success })
|
Guard::Notifier.expects(:notify).with("1 test, 0 failures, 5.0 secs.", { :title => 'Jasmine results', :image => :success })
|
||||||
|
|
||||||
Guard::JasmineHeadlessWebkitRunner.notify(file)
|
Guard::JasmineHeadlessWebkitRunner.notify(file)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with failures' do
|
context 'with failures' do
|
||||||
let(:data) { "1/0/F/5\nThis||Is||A||Failure\n" }
|
let(:data) { "TOTAL||1||1||5||F" }
|
||||||
|
|
||||||
it 'should notify with the right information' do
|
it 'should notify with the right information' do
|
||||||
Guard::Notifier.expects(:notify).with("1 test, 0 failures, 5 secs.", { :title => 'Jasmine results', :image => :success })
|
Guard::Notifier.expects(:notify).with("1 test, 1 failures, 5.0 secs.", { :title => 'Jasmine results', :image => :failed })
|
||||||
|
|
||||||
Guard::JasmineHeadlessWebkitRunner.notify(file)
|
Guard::JasmineHeadlessWebkitRunner.notify(file)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue