added notify specs

This commit is contained in:
Dmytrii Nagirniak 2011-06-17 20:49:50 +10:00
parent 457a7a35f8
commit be00189f1a

View File

@ -10,15 +10,15 @@ describe Guard::RailsAssets do
end end
describe '#start' do describe '#start' do
it_behaves_like 'guard command', :command => :start, :run => true it_behaves_like 'guard command', :command => :start, :run => true
end end
describe '#reload' do describe '#reload' do
it_behaves_like 'guard command', :command => :reload, :run => false it_behaves_like 'guard command', :command => :reload, :run => false
end end
describe '#run_all' do describe '#run_all' do
it_behaves_like 'guard command', :command => :run_all, :run => true it_behaves_like 'guard command', :command => :run_all, :run => true
end end
describe '#run_on_change' do describe '#run_on_change' do
@ -26,8 +26,22 @@ describe Guard::RailsAssets do
end end
describe 'asset compilation' do describe 'asset compilation using CLI' do
it 'should notify on success' def stub_system_with result
it 'should notify on failure' Kernel.stub(:system).with("rm -rf public/assets && bundle exec rake assets:precompile").and_return result
end
it 'should notify on success' do
stub_system_with true
Kernel.should_receive(:~).with('tree public/assets').and_return "a\nb\n1 directory, 2 files"
Guard::Notifier.should_receive(:notify).with('1 directory, 2 files', :title => 'Assets compiled')
subject.compile_assets
end
it 'should notify on failure' do
stub_system_with false
Kernel.should_not_receive(:~)
Guard::Notifier.should_receive(:notify).with('see the details in the terminal', :title => "Can't compile assets", :image => :failed)
subject.compile_assets
end
end end
end end