don't run on change if paths are empty

This commit is contained in:
John Bintz 2011-06-03 16:25:00 -04:00
parent 26326b5c32
commit 8497977cac
3 changed files with 39 additions and 2 deletions

View File

@ -6,3 +6,27 @@ task :push_everywhere do
system %{git push origin master} system %{git push origin master}
system %{git push guard master} system %{git push guard master}
end end
namespace :spec do
desc "Run on three Rubies"
task :platforms do
current = %x{rvm-prompt v}
fail = false
%w{1.8.7 1.9.2 ree}.each do |version|
puts "Switching to #{version}"
system %{rvm #{version}}
system %{bundle exec rspec spec}
if $?.exitstatus != 0
fail = true
break
end
end
system %{rvm #{current}}
exit (fail ? 1 : 0)
end
end
task :default => 'spec:platforms'

View File

@ -26,7 +26,11 @@ module Guard
@ran_jammit = false @ran_jammit = false
if run_before and run_jammit if run_before and run_jammit
@ran_jammit = true @ran_jammit = true
run_all if JasmineHeadlessWebkitRunner.run(paths) == 0 do_run_all = true
if !paths.empty?
do_run_all = (JasmineHeadlessWebkitRunner.run(paths) == 0)
end
run_all if do_run_all
end end
end end

View File

@ -44,6 +44,15 @@ describe Guard::JasmineHeadlessWebkit do
guard.run_on_change(%w{test}) guard.run_on_change(%w{test})
end end
end end
context 'no files given, just run all' do
it 'should run all but not run once' do
Guard::JasmineHeadlessWebkitRunner.expects(:run).never
guard.expects(:run_all).once
guard.run_on_change([])
end
end
end end
context 'with run_before' do context 'with run_before' do
@ -97,7 +106,7 @@ describe Guard::JasmineHeadlessWebkit do
let(:options) { { :jammit => true } } let(:options) { { :jammit => true } }
it "should run jammit only once" do it "should run jammit only once" do
guard.run_on_change([]) guard.run_on_change(%w{path.txt})
end end
end end
end end