Sha256: abbaf5760157d280afa0ebda7d1ec981ef471b7a5df07274438e40fb21c17a40

Contents?: true

Size: 734 Bytes

Versions: 2

Compression:

Stored size: 734 Bytes

Contents

require 'helper'

describe Prop::RateLimited do
  describe "#initialize" do
    before do
      time = Time.at(1333685680)
      Time.stubs(:now).returns(time)

      @error = Prop::RateLimited.new(:handle => "foo", :threshold => 10, :interval => 60, :cache_key => "wibble", :description => "Boom!")
    end

    it "return an error instance" do
      assert @error.is_a?(StandardError)
      assert @error.is_a?(Prop::RateLimited)

      assert_equal "foo", @error.handle
      assert_equal "wibble", @error.cache_key
      assert_equal "Boom!", @error.description
      assert_equal "foo threshold of 10 tries per 60s exceeded for key 'nil', hash wibble", @error.message
      assert_equal 20, @error.retry_after
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
prop-1.0.2 test/test_rate_limited.rb
prop-1.0.1 test/test_rate_limited.rb