Sha256: 5ce77f27fded16685b829bdbe6cdca53ed80c85736bd61064a13b8ebd1fc934d
Contents?: true
Size: 973 Bytes
Versions: 4
Compression:
Stored size: 973 Bytes
Contents
# vim:fileencoding=utf-8 require_relative 'test_helper' context 'scheduling jobs with hooks' do setup { Resque.redis.flushall } test 'before_schedule hook that does not return false should be enqueued' do enqueue_time = Time.now SomeRealClass.expects(:before_schedule_example).with(:foo) SomeRealClass.expects(:after_schedule_example).with(:foo) Resque.enqueue_at(enqueue_time.to_i, SomeRealClass, :foo) assert_equal(1, Resque.delayed_timestamp_size(enqueue_time.to_i), 'job should be enqueued') end test 'before_schedule hook that returns false should not be enqueued' do enqueue_time = Time.now SomeRealClass.expects(:before_schedule_example).with(:foo).returns(false) SomeRealClass.expects(:after_schedule_example).never Resque.enqueue_at(enqueue_time.to_i, SomeRealClass, :foo) assert_equal(0, Resque.delayed_timestamp_size(enqueue_time.to_i), 'job should not be enqueued') end end
Version data entries
4 entries across 4 versions & 1 rubygems