Merge pull request #5742 from betagouv/move-crons-jobs-dedicated-directory
move all the cron jobs in a dedicated directory
This commit is contained in:
commit
1fc7cfb159
23 changed files with 34 additions and 34 deletions
|
@ -1,4 +1,4 @@
|
|||
class AdministrateurActivateBeforeExpirationJob < CronJob
|
||||
class Cron::AdministrateurActivateBeforeExpirationJob < Cron::CronJob
|
||||
self.schedule_expression = "every day at 8 am"
|
||||
|
||||
def perform(*args)
|
|
@ -1,4 +1,4 @@
|
|||
class AutoArchiveProcedureJob < CronJob
|
||||
class Cron::AutoArchiveProcedureJob < Cron::CronJob
|
||||
self.schedule_expression = "every 1 minute"
|
||||
|
||||
def perform(*args)
|
|
@ -1,4 +1,4 @@
|
|||
class CronJob < ApplicationJob
|
||||
class Cron::CronJob < ApplicationJob
|
||||
queue_as :cron
|
||||
class_attribute :schedule_expression
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
class DeclarativeProceduresJob < CronJob
|
||||
class Cron::DeclarativeProceduresJob < Cron::CronJob
|
||||
self.schedule_expression = "every 1 minute"
|
||||
|
||||
def perform(*args)
|
|
@ -1,4 +1,4 @@
|
|||
class DiscardedDossiersDeletionJob < CronJob
|
||||
class Cron::DiscardedDossiersDeletionJob < Cron::CronJob
|
||||
self.schedule_expression = "every day at 2 am"
|
||||
|
||||
def perform(*args)
|
|
@ -1,4 +1,4 @@
|
|||
class DiscardedProceduresDeletionJob < CronJob
|
||||
class Cron::DiscardedProceduresDeletionJob < Cron::CronJob
|
||||
self.schedule_expression = "every day at 1 am"
|
||||
|
||||
def perform(*args)
|
|
@ -1,4 +1,4 @@
|
|||
class ExpiredDossiersDeletionJob < CronJob
|
||||
class Cron::ExpiredDossiersDeletionJob < Cron::CronJob
|
||||
self.schedule_expression = "every day at 7 am"
|
||||
|
||||
def perform(*args)
|
|
@ -1,4 +1,4 @@
|
|||
class FindDubiousProceduresJob < CronJob
|
||||
class Cron::FindDubiousProceduresJob < Cron::CronJob
|
||||
self.schedule_expression = "every day at midnight"
|
||||
|
||||
FORBIDDEN_KEYWORDS = [
|
|
@ -1,4 +1,4 @@
|
|||
class InstructeurEmailNotificationJob < CronJob
|
||||
class Cron::InstructeurEmailNotificationJob < Cron::CronJob
|
||||
self.schedule_expression = "from monday through friday at 10 am"
|
||||
|
||||
def perform(*args)
|
|
@ -1,4 +1,4 @@
|
|||
class NotifyDraftNotSubmittedJob < CronJob
|
||||
class Cron::NotifyDraftNotSubmittedJob < Cron::CronJob
|
||||
self.schedule_expression = "from monday through friday at 7 am"
|
||||
|
||||
def perform(*args)
|
|
@ -1,4 +1,4 @@
|
|||
class OperationsSignatureJob < CronJob
|
||||
class Cron::OperationsSignatureJob < Cron::CronJob
|
||||
self.schedule_expression = "every day at 6 am"
|
||||
|
||||
def perform(*args)
|
|
@ -1,4 +1,4 @@
|
|||
class PurgeStaleExportsJob < CronJob
|
||||
class Cron::PurgeStaleExportsJob < Cron::CronJob
|
||||
self.schedule_expression = "every 5 minutes"
|
||||
|
||||
def perform
|
|
@ -1,4 +1,4 @@
|
|||
class PurgeUnattachedBlobsJob < CronJob
|
||||
class Cron::PurgeUnattachedBlobsJob < Cron::CronJob
|
||||
self.schedule_expression = "every day at midnight"
|
||||
|
||||
def perform(*args)
|
|
@ -1,4 +1,4 @@
|
|||
class UpdateAdministrateurUsageStatisticsJob < CronJob
|
||||
class Cron::UpdateAdministrateurUsageStatisticsJob < Cron::CronJob
|
||||
self.schedule_expression = "every day at 10 am"
|
||||
|
||||
def perform
|
|
@ -1,4 +1,4 @@
|
|||
class UpdateStatsJob < CronJob
|
||||
class Cron::UpdateStatsJob < Cron::CronJob
|
||||
self.schedule_expression = "every 1 hour"
|
||||
|
||||
def perform(*args)
|
|
@ -1,4 +1,4 @@
|
|||
class WeeklyOverviewJob < CronJob
|
||||
class Cron::WeeklyOverviewJob < Cron::CronJob
|
||||
self.schedule_expression = "every monday at 7 am"
|
||||
|
||||
def perform(*args)
|
|
@ -1,10 +1,10 @@
|
|||
RSpec.describe AdministrateurActivateBeforeExpirationJob, type: :job do
|
||||
RSpec.describe Cron::AdministrateurActivateBeforeExpirationJob, type: :job do
|
||||
describe 'perform' do
|
||||
let(:administrateur) { create(:administrateur) }
|
||||
let(:user) { administrateur.user }
|
||||
let(:mailer_double) { double('mailer', deliver_later: true) }
|
||||
|
||||
subject { AdministrateurActivateBeforeExpirationJob.perform_now }
|
||||
subject { Cron::AdministrateurActivateBeforeExpirationJob.perform_now }
|
||||
|
||||
before do
|
||||
Timecop.freeze(Time.zone.local(2018, 03, 20))
|
|
@ -1,10 +1,10 @@
|
|||
RSpec.describe AutoArchiveProcedureJob, type: :job do
|
||||
RSpec.describe Cron::AutoArchiveProcedureJob, type: :job do
|
||||
let!(:procedure) { create(:procedure, :published, :with_instructeur, auto_archive_on: nil) }
|
||||
let!(:procedure_hier) { create(:procedure, :published, :with_instructeur, auto_archive_on: 1.day.ago.to_date) }
|
||||
let!(:procedure_aujourdhui) { create(:procedure, :published, :with_instructeur, auto_archive_on: Time.zone.today) }
|
||||
let!(:procedure_demain) { create(:procedure, :published, :with_instructeur, auto_archive_on: 1.day.from_now.to_date) }
|
||||
|
||||
subject { AutoArchiveProcedureJob.new.perform }
|
||||
subject { Cron::AutoArchiveProcedureJob.new.perform }
|
||||
|
||||
context "when procedures have no auto_archive_on" do
|
||||
before do
|
|
@ -1,4 +1,4 @@
|
|||
RSpec.describe DeclarativeProceduresJob, type: :job do
|
||||
RSpec.describe Cron::DeclarativeProceduresJob, type: :job do
|
||||
describe "perform" do
|
||||
let(:date) { Time.utc(2017, 9, 1, 10, 5, 0) }
|
||||
let(:instruction_date) { date + 120 }
|
||||
|
@ -20,7 +20,7 @@ RSpec.describe DeclarativeProceduresJob, type: :job do
|
|||
]
|
||||
|
||||
create(:attestation_template, procedure: procedure)
|
||||
DeclarativeProceduresJob.new.perform
|
||||
Cron::DeclarativeProceduresJob.new.perform
|
||||
|
||||
dossiers.each(&:reload)
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
RSpec.describe FindDubiousProceduresJob, type: :job do
|
||||
RSpec.describe Cron::FindDubiousProceduresJob, type: :job do
|
||||
describe 'perform' do
|
||||
let(:mailer_double) { double('mailer', deliver_later: true) }
|
||||
let(:procedure) { create(:procedure, types_de_champ: tdcs) }
|
||||
|
@ -11,7 +11,7 @@ RSpec.describe FindDubiousProceduresJob, type: :job do
|
|||
@dubious_procedures_args = arg
|
||||
end.and_return(mailer_double)
|
||||
|
||||
FindDubiousProceduresJob.new.perform
|
||||
Cron::FindDubiousProceduresJob.new.perform
|
||||
end
|
||||
|
||||
context 'with suspicious champs' do
|
|
@ -1,4 +1,4 @@
|
|||
RSpec.describe WeeklyOverviewJob, type: :job do
|
||||
RSpec.describe Cron::WeeklyOverviewJob, type: :job do
|
||||
describe 'perform' do
|
||||
let!(:instructeur) { create(:instructeur) }
|
||||
let(:overview) { double('overview') }
|
||||
|
@ -16,7 +16,7 @@ RSpec.describe WeeklyOverviewJob, type: :job do
|
|||
before do
|
||||
expect_any_instance_of(Instructeur).to receive(:last_week_overview).and_return(overview)
|
||||
allow(InstructeurMailer).to receive(:last_week_overview).and_return(mailer_double)
|
||||
WeeklyOverviewJob.new.perform
|
||||
Cron::WeeklyOverviewJob.new.perform
|
||||
end
|
||||
|
||||
it { expect(InstructeurMailer).to have_received(:last_week_overview).with(instructeur) }
|
||||
|
@ -27,7 +27,7 @@ RSpec.describe WeeklyOverviewJob, type: :job do
|
|||
before do
|
||||
expect_any_instance_of(Instructeur).to receive(:last_week_overview).and_return(nil)
|
||||
allow(InstructeurMailer).to receive(:last_week_overview)
|
||||
WeeklyOverviewJob.new.perform
|
||||
Cron::WeeklyOverviewJob.new.perform
|
||||
end
|
||||
|
||||
it { expect(InstructeurMailer).not_to have_received(:last_week_overview) }
|
||||
|
@ -37,7 +37,7 @@ RSpec.describe WeeklyOverviewJob, type: :job do
|
|||
context 'if the feature is disabled' do
|
||||
before do
|
||||
allow(Instructeur).to receive(:all)
|
||||
WeeklyOverviewJob.new.perform
|
||||
Cron::WeeklyOverviewJob.new.perform
|
||||
end
|
||||
|
||||
it { expect(Instructeur).not_to receive(:all) }
|
|
@ -455,7 +455,7 @@ describe Instructeur, type: :model do
|
|||
|
||||
before do
|
||||
procedure_to_assign.update(declarative_with_state: "en_instruction")
|
||||
DeclarativeProceduresJob.new.perform
|
||||
Cron::DeclarativeProceduresJob.new.perform
|
||||
dossier.reload
|
||||
end
|
||||
|
||||
|
@ -480,7 +480,7 @@ describe Instructeur, type: :model do
|
|||
|
||||
before do
|
||||
procedure_to_assign.update(declarative_with_state: "accepte")
|
||||
DeclarativeProceduresJob.new.perform
|
||||
Cron::DeclarativeProceduresJob.new.perform
|
||||
dossier.reload
|
||||
end
|
||||
|
||||
|
@ -497,7 +497,7 @@ describe Instructeur, type: :model do
|
|||
|
||||
before do
|
||||
procedure_to_assign.update(declarative_with_state: "accepte")
|
||||
DeclarativeProceduresJob.new.perform
|
||||
Cron::DeclarativeProceduresJob.new.perform
|
||||
dossier.traitements.last.update(processed_at: Time.zone.yesterday.beginning_of_day)
|
||||
dossier.reload
|
||||
end
|
||||
|
|
|
@ -51,7 +51,7 @@ describe NotificationService do
|
|||
let!(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
|
||||
before do
|
||||
procedure.update(declarative_with_state: "en_instruction")
|
||||
DeclarativeProceduresJob.new.perform
|
||||
Cron::DeclarativeProceduresJob.new.perform
|
||||
dossier.reload
|
||||
end
|
||||
|
||||
|
@ -65,7 +65,7 @@ describe NotificationService do
|
|||
let!(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
|
||||
before do
|
||||
procedure.update(declarative_with_state: "accepte")
|
||||
DeclarativeProceduresJob.new.perform
|
||||
Cron::DeclarativeProceduresJob.new.perform
|
||||
dossier.traitements.last.update!(processed_at: Time.zone.yesterday.beginning_of_day)
|
||||
dossier.reload
|
||||
end
|
||||
|
@ -80,7 +80,7 @@ describe NotificationService do
|
|||
let!(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
|
||||
before do
|
||||
procedure.update(declarative_with_state: "accepte")
|
||||
DeclarativeProceduresJob.new.perform
|
||||
Cron::DeclarativeProceduresJob.new.perform
|
||||
dossier.reload
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue