master/spec/guard/interactor_spec.rb
Michael Kessler 5f0c815256 Cleaning up all specs.
I basically went through all specs and applied the following rules:

* Use `describe` for methods and `context` for contexts.
* All class methods starts with `.` and instance methods with `#`.
* Removed all `it should`, because the specs _have to_.
* Applied a consistant naming on all listener specs.
* Make fixture usage more fail save by giving generous sleep times.
* Make all behaviour description non-technical and easy to understand.

The goal of this excercise was to have a documentation that is easy
readable and describes the behaviour and not the implementation.

Try it out by using the RSpec documentation format!
2011-05-13 11:26:05 +02:00

35 lines
751 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!(:options).and_return({})
Guard.stub!(:listener).and_return(mock(:start => nil, :stop => nil))
end
describe ".run_all" do
it "sends :run_all to all guards" do
guard.should_receive(:run_all)
subject.run_all
end
end
describe ".stop" do
it "sends :stop to all guards" do
guard.should_receive(:stop)
lambda { subject.stop }.should raise_error(SystemExit)
end
end
describe ".reload" do
it "sends :reload to all guards" do
guard.should_receive(:reload)
subject.reload
end
end
end