diff --git a/lib/guard/jasmine/runner.rb b/lib/guard/jasmine/runner.rb index d3b2669..f304970 100644 --- a/lib/guard/jasmine/runner.rb +++ b/lib/guard/jasmine/runner.rb @@ -34,7 +34,7 @@ def run(paths, options = { }) notify_start_message(paths, options) results = paths.inject([]) do |results, file| - results << evaluate_response(run_jasmine_spec(file, options), file, options) + results << evaluate_response(run_jasmine_spec(file, options), file, options) if File.exist?(file) results end.compact diff --git a/spec/guard/jasmine/runner_spec.rb b/spec/guard/jasmine/runner_spec.rb index a570d28..95e1ce1 100644 --- a/spec/guard/jasmine/runner_spec.rb +++ b/spec/guard/jasmine/runner_spec.rb @@ -146,6 +146,7 @@ describe '#run' do before do File.stub(:foreach).and_yield 'describe "ErrorTest", ->' + File.stub(:exist?).and_return(true) IO.stub(:popen).and_return StringIO.new(phantomjs_error_response) end @@ -155,6 +156,14 @@ end end + context 'when the spec file does not exist' do + it 'does nothing' do + File.stub(:exist?).with('spec/javascripts').and_return(false) + runner.should_not_receive(:evaluate_response) + runner.run(['spec/javascripts']) + end + end + context 'when passed the spec directory' do it 'requests all jasmine specs from the server' do IO.should_receive(:popen).with("#{ phantomjs_command } \"http://localhost:8888/jasmine\" 10000 failure true failure failure")