guard-rails-assets/spec/guard/rails-assets_spec.rb
James A. Rosen 8424beee1e obey config.assets.prefix. Closes #1. Closes #2.
Instead of doing an `rm -rf`, rely on `rake assets:clean`, which already
obeys the setting. Unfortunately, the call to figure out the count of assets
compiled would still need to have a directory specified. Thus, it's been
removed. Less information, but the compilation still works fine.
2011-06-19 14:06:23 -07:00

47 lines
1.4 KiB
Ruby

require 'spec_helper'
require 'guard/rails-assets'
describe Guard::RailsAssets do
let(:options) { {} }
subject { Guard::RailsAssets.new(['watchers'], options) }
it 'should be able to create guard' do
::Guard::RailsAssets.new(['watchers'], {:options=>:here}).should_not be_nil
end
describe '#start' do
it_behaves_like 'guard command', :command => :start, :run => true
end
describe '#reload' do
it_behaves_like 'guard command', :command => :reload, :run => false
end
describe '#run_all' do
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 using CLI' do
def stub_system_with result
subject.should_receive(:system).with("bundle exec rake assets:clean assets:precompile").and_return result
end
it 'should notify on success' do
stub_system_with true
Guard::Notifier.should_receive(:notify).with('Assets compiled')
subject.compile_assets
end
it 'should notify on failure' do
stub_system_with false
subject.should_not_receive(:`) # don't obtain tree
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