Sha256: 0ba52357899e7d7be3dd422fcb6581b1fb3b6f004576936e6455adb00ac32078
Contents?: true
Size: 923 Bytes
Versions: 7
Compression:
Stored size: 923 Bytes
Contents
require_relative 'test_helper' context "scheduling jobs with hooks" do setup do Resque.redis.flushall end 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
7 entries across 7 versions & 1 rubygems