Sha256: 9f89afb60021a78d1a70eec78e393b4e7b3ceeb30588ca05a3e7dfc31e789848
Contents?: true
Size: 935 Bytes
Versions: 3
Compression:
Stored size: 935 Bytes
Contents
RSpec.describe WorkerKiller::CountLimiter do subject{ described_class.new(**options) } let(:min){ rand(50..100) } let(:max){ min + rand(100) } let(:options){ { min: min, max: max, verbose: true } } it { is_expected.to have_attributes(min: min, max: max, limit: nil, left: nil) } context 'initialize limits after first check' do before { subject.check } it { is_expected.to have_attributes(min: min, max: max, limit: a_value_between(min, max), left: subject.limit - 1) } it 'expect not to react while less than limit' do (subject.limit - 2).times do expect(subject.check).to be_falsey end end it 'expect call reaction when check succeded' do (subject.limit - 2).times do expect(subject.check).to be_falsey end expect(subject.check).to be_truthy expect(subject.check).to be_truthy end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
worker_killer-1.1.0.223443 | spec/count_limiter_spec.rb |
worker_killer-1.1.0.214159 | spec/count_limiter_spec.rb |
worker_killer-1.1.0.214146 | spec/count_limiter_spec.rb |