Merge pull request #1075 from sgmap/fix_1053_declaratoire
[fix #1053] An Administrateur can choose the final dossier states
This commit is contained in:
commit
b2c9d8f227
2 changed files with 3 additions and 3 deletions
|
@ -1,10 +1,10 @@
|
||||||
class AutoReceiveDossiersForProcedureJob < ApplicationJob
|
class AutoReceiveDossiersForProcedureJob < ApplicationJob
|
||||||
queue_as :cron
|
queue_as :cron
|
||||||
|
|
||||||
def perform(procedure_id)
|
def perform(procedure_id, state)
|
||||||
procedure = Procedure.find_by(id: procedure_id)
|
procedure = Procedure.find_by(id: procedure_id)
|
||||||
if procedure
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,7 +7,7 @@ RSpec.describe AutoReceiveDossiersForProcedureJob, type: :job do
|
||||||
before { Timecop.freeze(date) }
|
before { Timecop.freeze(date) }
|
||||||
after { Timecop.return }
|
after { Timecop.return }
|
||||||
|
|
||||||
subject { AutoReceiveDossiersForProcedureJob.new.perform(procedure_id) }
|
subject { AutoReceiveDossiersForProcedureJob.new.perform(procedure_id, 'received') }
|
||||||
|
|
||||||
context "with some dossiers" do
|
context "with some dossiers" do
|
||||||
let(:nouveau_dossier1) { create(:dossier, :initiated) }
|
let(:nouveau_dossier1) { create(:dossier, :initiated) }
|
||||||
|
|
Loading…
Reference in a new issue