master/spec/guard/interactor_spec.rb
Nick Sieger 70c15a7c94 Extract code from signal handlers into methods
This will allow building other mechanisms to interact with Guard, for
example on JRuby, where signal handling tends to be unreliable.
2011-05-06 12:45:47 -05:00

26 lines
636 B
Ruby

require 'spec_helper'
describe Guard::Interactor do
subject { Guard::Interactor }
let(:guard) { mock "guard" }
before :each do
Guard.stub!(:guards).and_return([guard])
Guard.stub!(:listener).and_return(mock(:start => nil, :stop => nil))
end
it ".run_all should send :run_all to all guards" do
guard.should_receive(:run_all)
subject.run_all
end
it ".stop should send :stop to all guards" do
guard.should_receive(:stop)
lambda { subject.stop }.should raise_error(SystemExit)
end
it ".reload should send :reload to all guards" do
guard.should_receive(:reload)
subject.reload
end
end