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_schedule.rb
2014-03-28 15:37:31 -07:00

45 lines
1 KiB
Ruby

require_relative 'helper'
class TestSchedule < Sidetiq::TestCase
def test_method_missing
sched = Sidetiq::Schedule.new
sched.daily
assert_equal "Daily", sched.to_s
end
def test_schedule_next?
sched = Sidetiq::Schedule.new
sched.daily
assert sched.schedule_next?(Time.now + (24 * 60 * 60))
refute sched.schedule_next?(Time.now + (24 * 60 * 60))
assert sched.schedule_next?(Time.now + (2 * 24 * 60 * 60))
refute sched.schedule_next?(Time.now + (2 * 24 * 60 * 60))
end
def test_backfill
sched = Sidetiq::Schedule.new
refute sched.backfill?
sched.backfill = true
assert sched.backfill?
end
def test_set_options
sched = Sidetiq::Schedule.new
sched.set_options(backfill: true)
assert sched.backfill?
sched.set_options(backfill: false)
refute sched.backfill?
end
def test_use_utc
Sidetiq.config.utc = true
assert_equal(Time.utc(2010, 01, 01), Sidetiq::Schedule.new.start_time)
ensure
Sidetiq.config.utc = false
end
end