Fixing the runner to return false on the event of a failure and returning the original set of files in the event of a failure

This commit is contained in:
Steven Mitcham 2011-09-26 10:48:14 -05:00
parent 70b26b2c08
commit 862b82e869
3 changed files with 6 additions and 6 deletions

View File

@ -72,11 +72,10 @@ module Guard
else else
UI.info(SOME_SPECS_MESSAGE % paths.join(' ')) UI.info(SOME_SPECS_MESSAGE % paths.join(' '))
end end
if failed_files = JasmineHeadlessWebkitRunner.run(paths, @filtered_options) failed_files = JasmineHeadlessWebkitRunner.run(paths, @filtered_options)
failed_files = @files_to_rerun = failed_files.is_a?(Array) ? failed_files : [] @files_to_rerun = failed_files || paths
end
failed_files && @files_to_rerun.empty?
failed_files && failed_files.empty?
end end
def filter_paths(paths) def filter_paths(paths)

View File

@ -24,6 +24,7 @@ module Guard
end end
rescue Jasmine::Headless::InvalidReport => e rescue Jasmine::Headless::InvalidReport => e
Notifier.notify('Spec runner interrupted!', :title => 'Jasmine results', :image => :failed) Notifier.notify('Spec runner interrupted!', :title => 'Jasmine results', :image => :failed)
false
rescue Exception => e rescue Exception => e
p e p e
end end

View File

@ -49,7 +49,7 @@ REPORT
it 'should notify failure' do it 'should notify failure' do
Guard::Notifier.expects(:notify).with("Spec runner interrupted!", { :title => 'Jasmine results', :image => :failed }) Guard::Notifier.expects(:notify).with("Spec runner interrupted!", { :title => 'Jasmine results', :image => :failed })
Guard::JasmineHeadlessWebkitRunner.notify(file).should be_nil Guard::JasmineHeadlessWebkitRunner.notify(file).should be_false
end end
end end
end end