spec/throttler_spec.rb in redis-throttler-0.1.4 vs spec/throttler_spec.rb in redis-throttler-0.1.5

- old
+ new

@@ -1,27 +1,27 @@ require 'spec_helper' describe RedisThrottler do before do - @rl = RedisThrottler.new('test') + @rl = RedisThrottler::Base.new('test') @rl.send(:redis).flushdb end it 'should set_bucket_expiry to the bucket_span if not defined' do expect(@rl.instance_variable_get(:@bucket_span)).to eq(@rl.instance_variable_get(:@bucket_expiry)) end it 'should not allow bucket count less than 3' do expect do - RedisThrottler.new('test', {:bucket_span => 1, :bucket_interval => 1}) + RedisThrottler::Base.new('test', {:bucket_span => 1, :bucket_interval => 1}) end.to raise_error(ArgumentError) end it 'should not allow bucket expiry to be larger than the bucket span' do expect do - RedisThrottler.new("key", {:bucket_expiry => 1200}) + RedisThrottler::Base.new("key", {:bucket_expiry => 1200}) end.to raise_error(ArgumentError) end it 'should be able to add to the count for a given subject' do @rl.add("value1") @@ -92,10 +92,10 @@ # # end # # expect(@value).to be 1 # end it 'counts correclty if bucket_span equals count-interval ' do - @rl = RedisThrottler.new('key', {:bucket_span => 10, bucket_interval: 1}) + @rl = RedisThrottler::Base.new('key', {:bucket_span => 10, bucket_interval: 1}) @rl.add('value1') expect(@rl.count('value1', 10)).to eql(1) end end