Commit 874ed0cf authored by Antonio Terceiro's avatar Antonio Terceiro

Debci::Job: order pending jobs by creation date

This way listings will have the older jobs at the top.
parent fe939091
......@@ -21,7 +21,7 @@ module Debci
def self.pending
jobs = Debci::Job.where(status: nil)
jobs = Debci::Job.where(status: nil).order(:created_at)
def prefix
......@@ -14,6 +14,21 @@ describe Debci::Job do
expect(job.updated_at).to_not be_nil
it 'lists pending jobs' do
job = Debci::Job.create
expect(Debci::Job.pending).to include(job)
it 'sorts pending jobs with older first' do
job1 = Debci::Job.create
yesterday = -
expect(Time).to receive(:now).and_return(yesterday)
job0 = Debci::Job.create
expect(Debci::Job.pending).to eq([job0, job1])
it 'escapes trigger' do
job = 'foo bar')
expect(job.get_enqueue_parameters).to_not include('trigger:foo bar')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment