Sha256: bef6ce7e0972dc904eba252e406d2fc28751b932d5200e62d4e13dd626fbf8e3

Contents?: true

Size: 687 Bytes

Versions: 9

Compression:

Stored size: 687 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

9 entries across 9 versions & 1 rubygems

Version Path
worker_killer-1.0.5.213977 spec/count_limiter_spec.rb
worker_killer-1.0.5.213889 spec/count_limiter_spec.rb
worker_killer-1.0.4.189871 spec/count_limiter_spec.rb
worker_killer-1.0.3.189564 spec/count_limiter_spec.rb
worker_killer-1.0.3.189098 spec/count_limiter_spec.rb
worker_killer-1.0.2.187852 spec/count_limiter_spec.rb
worker_killer-1.0.2.187805 spec/count_limiter_spec.rb
worker_killer-1.0.2.187732 spec/count_limiter_spec.rb
worker_killer-1.0.1.83603 spec/count_limiter_spec.rb