Closed lessless closed 7 years ago
Any jobs you create will be PublicationJob.jobs
until PublicationJob.jobs.clear
is called.
I'm going to guess that you intended to use i
instead of "i"
. Try making this change
- expect(jobs.["i"]["run_at"]).to eq(moment)
+ expect(jobs[i]["run_at"]).to eq(moment)
The "i"
was my mistake indeed, but the queue is empty http://d.pr/i/SKcp
A couple more questions. What type is described_class
and what is the logic of today
? Does it include a call to PublicationJob.enqueue
?
described_class
is referencing Scheduler
object
RSpec.describe Scheduler do
end
Its #run
is nearly following:
def today(hour: DEFAULT_HOUR, minute: DEFAULT_MINUTE)
PublicationJob.enqueue channel_kind, @channel.id, run_at: DateTime.now.change(hour: hour, min: minute)
end
and as you can see on the screenshot it returns PublicationJob
with instance variable @destroyed
set to true
What is Que.mode
set to? The behavior seems like Que.mode
is :sync
. :sync
skips the adapter (the hook that que-testing uses). Make sure Que.mode
is set to :off
.
Indeed, that was the cause of the "problem". My apologies for polluting the tracker!
Hello,
I have simple test to check if job was scheduled or not, but it fails because of queue is empty
The job is put in a queue like this:
PublicationJob.enqueue channel_name, @channel.id
and returns following:<PublicationJob:0x007fbb11bd7080 @attrs={:args=>[channel_name, 3]}, @destroyed=true>