From f5d3818e3cdd27ed120f84c77c597376a8feb3af Mon Sep 17 00:00:00 2001 From: clemkeirua Date: Tue, 30 Jul 2019 10:12:57 +0200 Subject: [PATCH] remove unnecessary retransition methods --- app/controllers/gestionnaires/dossiers_controller.rb | 2 +- app/models/dossier.rb | 4 ---- spec/controllers/gestionnaires/dossiers_controller_spec.rb | 4 ++-- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/app/controllers/gestionnaires/dossiers_controller.rb b/app/controllers/gestionnaires/dossiers_controller.rb index 8cea6f1f6..a830229a4 100644 --- a/app/controllers/gestionnaires/dossiers_controller.rb +++ b/app/controllers/gestionnaires/dossiers_controller.rb @@ -109,7 +109,7 @@ module Gestionnaires if dossier.en_instruction? flash.notice = 'Le dossier est déjà en instruction.' else - if dossier.accepte? && !administration_signed_in? + if dossier.accepte? flash.notice = 'Il n’est pas possible de repasser un dossier accepté en instruction.' else flash.notice = "Le dossier #{dossier.id} a été repassé en instruction." diff --git a/app/models/dossier.rb b/app/models/dossier.rb index 10f6d0b1c..913976add 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -1,6 +1,5 @@ class Dossier < ApplicationRecord include DossierFilteringConcern - include Devise::Controllers::Helpers enum state: { brouillon: 'brouillon', @@ -230,9 +229,6 @@ class Dossier < ApplicationRecord !procedure.archivee? && brouillon? end - def can_retransition_to_en_instruction? - end - def can_be_updated_by_user? brouillon? || en_construction? end diff --git a/spec/controllers/gestionnaires/dossiers_controller_spec.rb b/spec/controllers/gestionnaires/dossiers_controller_spec.rb index 2f02eb67a..986ae1e46 100644 --- a/spec/controllers/gestionnaires/dossiers_controller_spec.rb +++ b/spec/controllers/gestionnaires/dossiers_controller_spec.rb @@ -193,8 +193,8 @@ describe Gestionnaires::DossiersController, type: :controller do end context 'as superadmin' do let (:current_user) { administration } - it 'it is possible to go back to en_instruction' do - expect(dossier.reload.state).to eq(Dossier.states.fetch(:en_instruction)) + it 'it is not possible to go back to en_instruction' do + expect(dossier.reload.state).to eq(Dossier.states.fetch(:accepte)) expect(response).to have_http_status(:ok) end end