2011-05-06 17:29:24 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Guard::Interactor do
|
|
|
|
subject { Guard::Interactor }
|
2011-05-13 09:26:05 +00:00
|
|
|
|
2011-05-06 17:29:24 +00:00
|
|
|
let(:guard) { mock "guard" }
|
2011-05-06 19:14:39 +00:00
|
|
|
|
2011-05-06 17:29:24 +00:00
|
|
|
before :each do
|
|
|
|
Guard.stub!(:guards).and_return([guard])
|
2011-05-06 19:14:39 +00:00
|
|
|
Guard.stub!(:options).and_return({})
|
2011-05-06 17:29:24 +00:00
|
|
|
Guard.stub!(:listener).and_return(mock(:start => nil, :stop => nil))
|
2011-08-16 23:34:27 +00:00
|
|
|
guard.should_receive(:hook).twice
|
2011-05-06 17:29:24 +00:00
|
|
|
end
|
|
|
|
|
2011-05-13 09:26:05 +00:00
|
|
|
describe ".run_all" do
|
|
|
|
it "sends :run_all to all guards" do
|
|
|
|
guard.should_receive(:run_all)
|
|
|
|
subject.run_all
|
|
|
|
end
|
2011-05-06 17:29:24 +00:00
|
|
|
end
|
|
|
|
|
2011-05-13 09:26:05 +00:00
|
|
|
describe ".stop" do
|
|
|
|
it "sends :stop to all guards" do
|
|
|
|
guard.should_receive(:stop)
|
|
|
|
lambda { subject.stop }.should raise_error(SystemExit)
|
|
|
|
end
|
2011-05-06 17:29:24 +00:00
|
|
|
end
|
|
|
|
|
2011-05-13 09:26:05 +00:00
|
|
|
describe ".reload" do
|
|
|
|
it "sends :reload to all guards" do
|
|
|
|
guard.should_receive(:reload)
|
|
|
|
subject.reload
|
|
|
|
end
|
2011-05-06 17:29:24 +00:00
|
|
|
end
|
|
|
|
end
|