From 44819bb0b19426282e407f9794956b1c6d7d308f Mon Sep 17 00:00:00 2001 From: Mathieu Magnin Date: Mon, 6 Mar 2017 15:59:52 +0100 Subject: [PATCH] Fix reopened dossier should not be listed in new dossiers --- app/controllers/backoffice/dossiers_controller.rb | 4 ++-- spec/controllers/backoffice/dossiers_controller_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/backoffice/dossiers_controller.rb b/app/controllers/backoffice/dossiers_controller.rb index 089a2633c..14dd0a230 100644 --- a/app/controllers/backoffice/dossiers_controller.rb +++ b/app/controllers/backoffice/dossiers_controller.rb @@ -168,11 +168,11 @@ class Backoffice::DossiersController < Backoffice::DossiersListController end redirect_to backoffice_dossier_path(@dossier) end - + def reopen create_dossier_facade params[:dossier_id] - @facade.dossier.initiated! + @facade.dossier.replied! flash.notice = 'Dossier réouvert.' redirect_to backoffice_dossiers_path diff --git a/spec/controllers/backoffice/dossiers_controller_spec.rb b/spec/controllers/backoffice/dossiers_controller_spec.rb index 572e3a795..72de50eca 100644 --- a/spec/controllers/backoffice/dossiers_controller_spec.rb +++ b/spec/controllers/backoffice/dossiers_controller_spec.rb @@ -362,11 +362,11 @@ describe Backoffice::DossiersController, type: :controller do subject { post :reopen, params: {dossier_id: dossier_id} } - it 'change state to initiated' do + it 'change state to replied' do subject dossier.reload - expect(dossier.state).to eq('initiated') + expect(dossier.state).to eq('replied') end it { is_expected.to redirect_to backoffice_dossiers_path }