Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions test/scheduler_hooks_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ def enqueued

test 'before_schedule hook that does not return false should be enqueued' do
enqueue_time = Time.now + 1
SomeRealClass.expects(:before_schedule_example).with(:foo)
SomeRealClass.expects(:after_schedule_example).with(:foo)
Resque.enqueue_at(enqueue_time.to_i, SomeRealClass, :foo)
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 + 1
SomeRealClass.expects(:before_schedule_example).with(:foo).returns(false)
SomeRealClass.expects(:before_schedule_example).with('foo').returns(false)
SomeRealClass.expects(:after_schedule_example).never
Resque.enqueue_at(enqueue_time.to_i, SomeRealClass, :foo)
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
Expand Down
Loading