Skip to content

Commit

Permalink
Specs for :run_at_start and #run_all
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Demmel committed Dec 4, 2012
1 parent f2024d2 commit a05c744
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions spec/guard/copy_spec.rb
Expand Up @@ -183,6 +183,37 @@ module Guard
end
end

it 'executes #run_all if :run_at_start option is true' do
dir('source')
dir('target')
guard = Copy.new([], :from => 'source', :to => 'target', :run_at_start => true)
guard.should_receive(:run_all)
guard.start
end

end

describe '#run_all' do

it 'should copy all files matching watcher patterns' do
dir('source')
dir('source/css')
file('source/foo.rb')
file('source/foo.js')
file('source/css/foo.css')
dir('target')
dir('target/css')
guard = Copy.new([
Watcher.new(%r{^.+\.js$}),
Watcher.new(%r{^.+\.css$})
], :from => 'source', :to => 'target')
guard.start
guard.run_all
File.should be_file('target/foo.js')
File.should be_file('target/css/foo.css')
File.should_not be_file('target/foo.rb')
end

end

describe '#run_on_changes' do
Expand Down

0 comments on commit a05c744

Please sign in to comment.