Skip to content

Commit

Permalink
Merge pull request #60 from huyhoang1970/master
Browse files Browse the repository at this point in the history
Does nothing if the spec file does not exist
  • Loading branch information
netzpirat committed May 18, 2012
2 parents 237fcbd + de6b75e commit 6d2ee05
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/guard/jasmine/runner.rb
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions spec/guard/jasmine/runner_spec.rb
Expand Up @@ -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

Expand All @@ -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")
Expand Down

0 comments on commit 6d2ee05

Please sign in to comment.