Sha256: 0c80803bc9c804a0fa8e5c7ab41011706854fcba2a1ea542cbf4d307d7892a14
Contents?: true
Size: 1.1 KB
Versions: 2
Compression:
Stored size: 1.1 KB
Contents
require 'spec_helper' require 'delayed_job_active_record' describe StatusCat::Checkers::DelayedJob do let( :checker ) { StatusCat::Checkers::DelayedJob.new.freeze } before( :each ) do end it_should_behave_like 'a status checker' it 'tolerates Delayed::Job being undefined' do dj = Object.send(:remove_const, :Delayed) expect( checker.status ).to_not be_nil Object.const_set( :Delayed, dj ) end it 'fails if there is an exception' do ActiveRecord::Base.connection.should_receive( :execute ).and_raise( :error ) expect( checker.status ).to_not be_nil end it 'fails if there are expired jobs' do ActiveRecord::Base.connection.should_receive( :execute ).and_return( [1], [1] ) expect( checker.status ).to_not be_nil end it 'passes if there are no expired jobs' do ActiveRecord::Base.connection.should_receive( :execute ).and_return( [1], [0] ) expect( checker.status ).to be_nil end it 'uses the job count as the value' do ActiveRecord::Base.connection.should_receive( :execute ).and_return( [1], [0] ) expect( checker.value ).to eql( 1 ) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
status_cat-0.1.0 | spec/lib/status_cat/checkers/delayed_job_spec.rb |
status_cat-0.0.9 | spec/lib/status_cat/checkers/delayed_job_spec.rb |