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) { '' }