1
0
Fork 0
mirror of https://github.com/endofunky/sidetiq.git synced 2022-11-09 13:53:30 -05:00
endofunky--sidetiq/test/test_sidetiq.rb
2013-01-31 17:42:19 +00:00

37 lines
708 B
Ruby

require_relative 'helper'
class TestSidetiq < MiniTest::Unit::TestCase
class Worker
include Sidekiq::Worker
include Sidetiq::Schedulable
tiq do
daily.hour_of_day(0)
end
end
def clock
@clock ||= Sidetiq::Clock.instance
end
def tick
clock.tick
end
def test_scheduling
assert_equal 0, Worker.jobs.size # sanity
clock.stubs(:gettime).returns(Time.now + (24 * 60 * 60))
tick
assert_equal 1, Worker.jobs.size
clock.stubs(:gettime).returns(Time.now + (2 * 24 * 60 * 60))
tick
assert_equal 2, Worker.jobs.size
clock.stubs(:gettime).returns(Time.now + (2 * 24 * 60 * 60 + 1))
tick
assert_equal 2, Worker.jobs.size
end
end