Sha256: 486aff585fcb23de3d9460a52b2156cdaaa8ceacd87aee7759dc2e6216f73897
Contents?: true
Size: 784 Bytes
Versions: 3
Compression:
Stored size: 784 Bytes
Contents
require File.join(File.dirname(__FILE__), '..', 'spec_helper') describe Rack::Throttle::UrlMatcher do include Rack::Test::Methods def app @target_app ||= example_target_app @app ||= Rack::Throttle::Limiter.new(@target_app, :rules => {:url => /foo/}) end it "should not bother checking if the path doesn't match the rule" do app.should_not_receive(:allowed?) get "/bar" last_response.body.should show_allowed_response end it "should check if the path matches the rule" do app.should_receive(:allowed?).and_return(false) get "/foo" last_response.body.should show_throttled_response end it "should append the rule to the cache key" do get "/foo" app.send(:cache_key, last_request).should == "127.0.0.1:url-/foo/" end end
Version data entries
3 entries across 3 versions & 2 rubygems