From 3fb7d8ac2483dccccbf923de863ad5cbe4911046 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Thu, 14 Jul 2011 06:50:47 -0400 Subject: [PATCH] fix for new JHW where failure details are part of the report --- lib/guard/jasmine-headless-webkit/runner.rb | 2 +- spec/lib/guard/jasmine-headless-webkit/runner_spec.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/guard/jasmine-headless-webkit/runner.rb b/lib/guard/jasmine-headless-webkit/runner.rb index a2ff190..9d99b61 100644 --- a/lib/guard/jasmine-headless-webkit/runner.rb +++ b/lib/guard/jasmine-headless-webkit/runner.rb @@ -17,7 +17,7 @@ module Guard if (data = File.read(file).strip).empty? Notifier.notify('Spec runner interrupted!', :title => 'Jasmine results', :image => :failed) else - total, fails, any_console, secs = File.read(file).strip.split('/') + total, fails, any_console, secs = data.lines.first.strip.split('/') Notifier.notify(message(total, fails, secs, any_console == "T"), :title => 'Jasmine results', :image => image(any_console == "T", fails)) fails.to_i diff --git a/spec/lib/guard/jasmine-headless-webkit/runner_spec.rb b/spec/lib/guard/jasmine-headless-webkit/runner_spec.rb index cecc65e..472d12f 100644 --- a/spec/lib/guard/jasmine-headless-webkit/runner_spec.rb +++ b/spec/lib/guard/jasmine-headless-webkit/runner_spec.rb @@ -22,6 +22,16 @@ describe Guard::JasmineHeadlessWebkitRunner do end end + context 'with failures' do + let(:data) { "1/0/F/5\nThis||Is||A||Failure\n" } + + 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::JasmineHeadlessWebkitRunner.notify(file) + end + end + context 'system run interrupted' do let(:data) { '' }