Sha256: 6ea9cdcc4f55955ffd642eae0cd5e7a6ee4577186768cb431a40b459b284e453
Contents?: true
Size: 1.01 KB
Versions: 5
Compression:
Stored size: 1.01 KB
Contents
describe StatusCat::Checkers::DelayedJob do let(:checker) { StatusCat::Checkers::DelayedJob.new.freeze } it_should_behave_like 'a status checker' it 'tolerates the gem missing' do gem = Object.send(:remove_const, :Delayed) expect(checker.status).to eql('delayed_job gem is not installed') Object.const_set(:Delayed, gem) end it 'fails if there is an exception' do expect(ActiveRecord::Base.connection).to receive(:execute).and_raise(:error) expect(checker.status).to_not be_nil end it 'fails if there are expired jobs' do expect(ActiveRecord::Base.connection).to receive(:execute).and_return([1], [1]) expect(checker.status).to_not be_nil end it 'passes if there are no expired jobs' do expect(ActiveRecord::Base.connection).to receive(:execute).and_return([1], [0]) expect(checker.status).to be_nil end it 'uses the job count as the value' do expect(ActiveRecord::Base.connection).to receive(:execute).and_return([1], [0]) expect(checker.value).to eql(1) end end
Version data entries
5 entries across 5 versions & 1 rubygems