[fix #1053] An Administrateur can choose the final dossier states

! before going to production :
- stopping the current AutoReceiveJob
- relaunch the jobs with previous id and state = 'received'
This commit is contained in:
Simon Lehericey 2017-12-11 16:31:54 +01:00
parent b90fb2f908
commit 77907b66d7
2 changed files with 3 additions and 3 deletions

View file

@ -1,10 +1,10 @@
class AutoReceiveDossiersForProcedureJob < ApplicationJob
queue_as :cron
def perform(procedure_id)
def perform(procedure_id, state)
procedure = Procedure.find_by(id: procedure_id)
if procedure
procedure.dossiers.state_nouveaux.update_all(state: "received", received_at: Time.now)
procedure.dossiers.state_nouveaux.update_all(state: state, received_at: Time.now)
end
end
end

View file

@ -7,7 +7,7 @@ RSpec.describe AutoReceiveDossiersForProcedureJob, type: :job do
before { Timecop.freeze(date) }
after { Timecop.return }
subject { AutoReceiveDossiersForProcedureJob.new.perform(procedure_id) }
subject { AutoReceiveDossiersForProcedureJob.new.perform(procedure_id, 'received') }
context "with some dossiers" do
let(:nouveau_dossier1) { create(:dossier, :initiated) }