Skip to content

Commit

Permalink
added notify specs
Browse files Browse the repository at this point in the history
  • Loading branch information
dnagir committed Jun 17, 2011
1 parent 457a7a3 commit be00189
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions spec/guard/rails-assets_spec.rb
Expand Up @@ -10,24 +10,38 @@
end

describe '#start' do
it_behaves_like 'guard command', :command => :start, :run => true
it_behaves_like 'guard command', :command => :start, :run => true
end

describe '#reload' do
it_behaves_like 'guard command', :command => :reload, :run => false
it_behaves_like 'guard command', :command => :reload, :run => false
end

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

describe '#run_on_change' do
it_behaves_like 'guard command', :command => :run_on_change, :run => true
end


describe 'asset compilation' do
it 'should notify on success'
it 'should notify on failure'
describe 'asset compilation using CLI' do
def stub_system_with result
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

0 comments on commit be00189

Please sign in to comment.