remove unnecessary retransition methods

This commit is contained in:
clemkeirua 2019-07-30 10:12:57 +02:00
parent 2f82dd9a3d
commit f5d3818e3c
3 changed files with 3 additions and 7 deletions

View file

@ -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 nest pas possible de repasser un dossier accepté en instruction.'
else
flash.notice = "Le dossier #{dossier.id} a été repassé en instruction."

View file

@ -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

View file

@ -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