spec/lib/rack/harakiri_spec.rb in picky-0.3.0 vs spec/lib/rack/harakiri_spec.rb in picky-0.9.0
- old
+ new
@@ -10,9 +10,37 @@
@harakiri = Rack::Harakiri.new @app
end
it "should quit after an amount of requests" do
@harakiri.quit_after_requests.should == 50
end
+ describe "harakiri" do
+ it "should kill the process after 50 harakiri calls" do
+ Process.should_receive(:kill).once
+
+ 50.times { @harakiri.harakiri }
+ end
+ it "should not kill the process after 49 harakiri calls" do
+ Process.should_receive(:kill).never
+
+ 49.times { @harakiri.harakiri }
+ end
+ end
+ describe "call" do
+ before(:each) do
+ @app.stub! :call
+ @app.stub! :harakiri
+ end
+ it "calls harakiri" do
+ @harakiri.should_receive(:harakiri).once.with
+
+ @harakiri.call :env
+ end
+ it "calls the app" do
+ @app.should_receive(:call).once.with :env
+
+ @harakiri.call :env
+ end
+ end
end
context "with harakiri set" do
before(:each) do
Rack::Harakiri.after = 100
@harakiri = Rack::Harakiri.new @app
\ No newline at end of file