2011-06-21 13:48:27 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Guard::DslDescriber do
|
2011-10-04 07:04:50 +00:00
|
|
|
|
|
|
|
let(:describer) { ::Guard::DslDescriber }
|
|
|
|
|
|
|
|
let(:guardfile) do
|
|
|
|
<<-GUARD
|
|
|
|
guard 'test', :a => :b do
|
|
|
|
watch('c')
|
|
|
|
end
|
|
|
|
|
|
|
|
group :a do
|
|
|
|
guard 'test', :x => 1, :y => 2, :z => 3 do
|
|
|
|
watch('c')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
group "b" do
|
|
|
|
guard 'another' do
|
|
|
|
watch('c')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
GUARD
|
2011-08-31 07:47:03 +00:00
|
|
|
end
|
2011-07-02 08:01:45 +00:00
|
|
|
|
2011-10-04 07:04:50 +00:00
|
|
|
before do
|
|
|
|
@output = ''
|
|
|
|
Guard::UI.stub(:info) { |msg| @output << msg + "\n" }
|
|
|
|
end
|
2011-06-21 13:48:27 +00:00
|
|
|
|
2011-10-04 07:04:50 +00:00
|
|
|
after do
|
|
|
|
Guard::UI.unstub(:info)
|
2011-06-21 13:48:27 +00:00
|
|
|
end
|
|
|
|
|
2011-10-04 07:04:50 +00:00
|
|
|
describe '.list' do
|
|
|
|
it 'lists the available Guards' do
|
|
|
|
Guard.stub(:guard_gem_names).and_return ['test', 'another', 'even', 'more']
|
|
|
|
describer.list(:guardfile_contents => guardfile)
|
|
|
|
@output.should eql <<OUTPUT
|
|
|
|
Using inline Guardfile.
|
|
|
|
Available guards:
|
|
|
|
another*
|
|
|
|
even
|
|
|
|
more
|
|
|
|
test*
|
|
|
|
|
|
|
|
See also https://github.com/guard/guard/wiki/List-of-available-Guards
|
|
|
|
* denotes ones already in your Guardfile
|
|
|
|
OUTPUT
|
|
|
|
end
|
2011-06-21 13:48:27 +00:00
|
|
|
end
|
|
|
|
|
2011-10-04 07:04:50 +00:00
|
|
|
describe '.show' do
|
|
|
|
it 'shows the Guards and their options' do
|
|
|
|
describer.show(:guardfile_contents => guardfile)
|
|
|
|
@output.should eql <<OUTPUT
|
|
|
|
Using inline Guardfile.
|
|
|
|
(global):
|
|
|
|
test: a => :b
|
|
|
|
Group a:
|
|
|
|
test: x => 1, y => 2, z => 3
|
|
|
|
Group b:
|
|
|
|
another
|
2011-06-21 13:48:27 +00:00
|
|
|
|
2011-10-04 07:04:50 +00:00
|
|
|
OUTPUT
|
|
|
|
end
|
2011-06-21 13:48:27 +00:00
|
|
|
end
|
2011-09-22 22:22:44 +00:00
|
|
|
|
2011-06-21 13:48:27 +00:00
|
|
|
end
|