spec/limiter_spec.rb in railslove-rack-throttle-0.0.0 vs spec/limiter_spec.rb in railslove-rack-throttle-0.0.1
- old
+ new
@@ -48,17 +48,15 @@
get "/foo"
last_response.body.should show_allowed_response
end
it "should call proc when false" do
- #proc = mock("test")
- #@app = Rack::Throttle::Limiter.new(@target_app, :on_reject => proc)
- #
- #app.should_receive(:allowed?).and_return(false)
- #proc.should_receive(:call).once
- #
- #get "/foo"
- #
- #@app = Rack::Throttle::Limiter.new(@target_app)
+ proc = mock("test")
+ @app = Rack::Throttle::Limiter.new(@target_app, :on_reject => proc)
+
+ app.stub!(:allowed?).and_return(false)
+ proc.should_receive(:call).once.with(an_instance_of(Hash))
+
+ get "/foo"
end
end
end
\ No newline at end of file