Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does nothing if the spec file does not exist #60

Merged
merged 1 commit into from May 18, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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