Add some specs for Guard.start (just to ensure core methods are well called…)

This commit is contained in:
Rémy Coutable 2011-07-29 00:23:20 +02:00
parent 1481604411
commit 38067f447f
2 changed files with 17 additions and 0 deletions

1
spec/fixtures/Guardfile vendored Normal file
View File

@ -0,0 +1 @@
# nothing here, it's just for feeding the specs! :)

View File

@ -23,6 +23,11 @@ describe Guard do
::Guard.listener.should be_kind_of(Guard::Listener) ::Guard.listener.should be_kind_of(Guard::Listener)
end end
it "respect the watchdir option" do
::Guard.setup(:watchdir => "/foo/bar")
::Guard.listener.directory.should eql "/foo/bar"
end
it "turns on the notifier by default" do it "turns on the notifier by default" do
ENV["GUARD_NOTIFY"] = nil ENV["GUARD_NOTIFY"] = nil
::Guard::Notifier.should_receive(:turn_on) ::Guard::Notifier.should_receive(:turn_on)
@ -41,6 +46,17 @@ describe Guard do
end end
end end
describe ".start" do
it "basic check that core methods are called" do
opts = { :my_opts => true, :guardfile => File.join(@fixture_path, "Guardfile") }
::Guard.should_receive(:setup).with(opts)
::Guard::Dsl.should_receive(:evaluate_guardfile).with(opts)
::Guard.listener.should_receive(:start)
::Guard.start(opts)
end
end
describe ".get_guard_class" do describe ".get_guard_class" do
after do after do
[:Classname, :DashedClassName, :Inline].each do |const| [:Classname, :DashedClassName, :Inline].each do |const|