Sha256: 4ea5b67a3e935efa898c6eaee7f09c58b8605c0072ef57dd45de1e7a9db2e1b7
Contents?: true
Size: 792 Bytes
Versions: 2
Compression:
Stored size: 792 Bytes
Contents
require File.join(File.dirname(__FILE__), '..', 'spec_helper') describe Rack::Throttle::Daily do include Rack::Test::Methods def app @target_app ||= example_target_app @app ||= Rack::Throttle::Daily.new(@target_app, :max_per_day => 3) end it "should be allowed if not seen this day" do get "/foo" expect(last_response.body).to show_allowed_response end it "should be allowed if seen fewer than the max allowed per day" do 2.times { get "/foo" } expect(last_response.body).to show_allowed_response end it "should not be allowed if seen more times than the max allowed per day" do 4.times { get "/foo" } expect(last_response.body).to show_throttled_response end # TODO mess with time travelling and requests to make sure no overlap end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
improved-rack-throttle-0.9.0 | spec/limiters/daily_spec.rb |
improved-rack-throttle-0.8.0 | spec/limiters/daily_spec.rb |