Sha256: f995fd88b6f5ffe332a163badac70ffde858e218a93d9b52bd8348890b668d71

Contents?: true

Size: 800 Bytes

Versions: 8

Compression:

Stored size: 800 Bytes

Contents

require 'helper'

class TestRateLimited < Test::Unit::TestCase

  context Prop::RateLimited do
    context "#initialize" do
      setup 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

      should "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/60s exceeded for key 'wibble'", @error.message
        assert_equal 20, @error.retry_after
      end
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
prop-0.7.7 test/test_rate_limited.rb
prop-0.7.6 test/test_rate_limited.rb
prop-0.7.5 test/test_rate_limited.rb
prop-0.7.4 test/test_rate_limited.rb
prop-0.7.3 test/test_rate_limited.rb
prop-0.7.2 test/test_rate_limited.rb
prop-0.7.1 test/test_rate_limited.rb
prop-0.7.0 test/test_rate_limited.rb