Sha256: 78918d01aaab0d1a0524bf5fb598ca1df6d70bd2638371437cc8623307cb3b2d

Contents?: true

Size: 685 Bytes

Versions: 5

Compression:

Stored size: 685 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: a_value_between(min, max), left: subject.limit) }

  it 'expect not to react while less than limit' do
    (subject.limit - 1).times do
      expect(subject.check).to be_falsey
    end
  end

  it 'expect call reaction when check succeded' do
    (subject.limit - 1).times do
      expect(subject.check).to be_falsey
    end

    expect(subject.check).to be_truthy
    expect(subject.check).to be_truthy
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
worker_killer-1.0.1.75538 spec/count_limiter_spec.rb
worker_killer-1.0.1.39842 spec/count_limiter_spec.rb
worker_killer-1.0.0.39841 spec/count_limiter_spec.rb
worker_killer-1.0.0.39839 spec/count_limiter_spec.rb
worker_killer-0.1.1.39838 spec/count_limiter_spec.rb