[fix #504] Dossier: without_continuation -> sans_suite

This commit is contained in:
Simon Lehericey 2017-12-04 20:23:57 +01:00 committed by LeSim
parent 2be9b8d2ba
commit c83552f423
22 changed files with 64 additions and 41 deletions

View file

@ -18,7 +18,7 @@ class Users::RecapitulatifController < UsersController
def self.route_authorization def self.route_authorization
{ {
states: [:en_construction, :en_instruction, :without_continuation, :accepte, :refuse] states: [:en_construction, :en_instruction, :sans_suite, :accepte, :refuse]
} }
end end

View file

@ -2,7 +2,7 @@ module DossierHelper
def button_or_label_class(dossier) def button_or_label_class(dossier)
if dossier.accepte? if dossier.accepte?
'accepted' 'accepted'
elsif dossier.without_continuation? elsif dossier.sans_suite?
'without-continuation' 'without-continuation'
elsif dossier.refuse? elsif dossier.refuse?
'refuse' 'refuse'

View file

@ -5,7 +5,7 @@ class Dossier < ActiveRecord::Base
en_instruction: 'en_instruction', en_instruction: 'en_instruction',
accepte: 'accepte', accepte: 'accepte',
refuse: 'refuse', refuse: 'refuse',
without_continuation: 'without_continuation' sans_suite: 'sans_suite'
} }
BROUILLON = %w(brouillon) BROUILLON = %w(brouillon)
@ -13,7 +13,7 @@ class Dossier < ActiveRecord::Base
EN_CONSTRUCTION = %w(en_construction) EN_CONSTRUCTION = %w(en_construction)
EN_INSTRUCTION = %w(en_instruction) EN_INSTRUCTION = %w(en_instruction)
EN_CONSTRUCTION_OU_INSTRUCTION = EN_CONSTRUCTION + EN_INSTRUCTION EN_CONSTRUCTION_OU_INSTRUCTION = EN_CONSTRUCTION + EN_INSTRUCTION
TERMINE = %w(accepte refuse without_continuation) TERMINE = %w(accepte refuse sans_suite)
has_one :etablissement, dependent: :destroy has_one :etablissement, dependent: :destroy
has_one :entreprise, dependent: :destroy has_one :entreprise, dependent: :destroy
@ -186,7 +186,7 @@ class Dossier < ActiveRecord::Base
end end
when 'without_continuation' when 'without_continuation'
if en_instruction? if en_instruction?
without_continuation! sans_suite!
if motivation if motivation
self.motivation = motivation self.motivation = motivation
@ -283,7 +283,7 @@ class Dossier < ActiveRecord::Base
end end
def read_only? def read_only?
en_instruction? || accepte? || refuse? || without_continuation? en_instruction? || accepte? || refuse? || sans_suite?
end end
def owner? email def owner? email
@ -366,7 +366,7 @@ class Dossier < ActiveRecord::Base
def statut def statut
if accepte? if accepte?
'accepté' 'accepté'
elsif without_continuation? elsif sans_suite?
'classé sans suite' 'classé sans suite'
elsif refuse? elsif refuse?
'refusé' 'refusé'

View file

@ -45,6 +45,8 @@ class DossierSerializer < ActiveModel::Serializer
'closed' 'closed'
when 'refuse' when 'refuse'
'refused' 'refused'
when 'sans_suite'
'without_continuation'
else else
object.state object.state
end end

View file

@ -32,6 +32,8 @@ class DossierTableExportSerializer < ActiveModel::Serializer
'closed' 'closed'
when 'refuse' when 'refuse'
'refused' 'refused'
when 'sans_suite'
'without_continuation'
else else
object.state object.state
end end

View file

@ -6,5 +6,5 @@
%span.label.accepted accepté %span.label.accepted accepté
- elsif dossier.refuse? - elsif dossier.refuse?
%span.label.refused refusé %span.label.refused refusé
- elsif dossier.without_continuation? - elsif dossier.sans_suite?
%span.label.without-continuation sans suite %span.label.without-continuation sans suite

View file

@ -13,7 +13,7 @@ fr:
en_instruction: "En instruction" en_instruction: "En instruction"
accepte: "Accepté" accepte: "Accepté"
refuse: "Refusé" refuse: "Refusé"
without_continuation: "Sans suite" sans_suite: "Sans suite"
errors: errors:
models: models:

View file

@ -18,4 +18,11 @@ namespace :'2017_12_04_translate_dossier_state_to_french' do
task refuse: :environment do task refuse: :environment do
Dossier.unscoped.where(state: 'refused').update_all(state: 'refuse') Dossier.unscoped.where(state: 'refused').update_all(state: 'refuse')
end end
task sans_suite: :environment do
Dossier.unscoped.where(state: 'without_continuation').update_all(state: 'sans_suite')
end
task all: %i(brouillon en_construction en_instruction accepte refuse sans_suite) do
end
end end

View file

@ -260,7 +260,7 @@ describe Backoffice::DossiersController, type: :controller do
it { is_expected.to redirect_to backoffice_dossier_path(id: dossier.id) } it { is_expected.to redirect_to backoffice_dossier_path(id: dossier.id) }
end end
context "with without_continuation" do context "with sans_suite" do
before do before do
dossier.en_instruction! dossier.en_instruction!
sign_in gestionnaire sign_in gestionnaire
@ -268,11 +268,11 @@ describe Backoffice::DossiersController, type: :controller do
subject { post :process_dossier, params: { process_action: "without_continuation", dossier_id: dossier_id} } subject { post :process_dossier, params: { process_action: "without_continuation", dossier_id: dossier_id} }
it 'change state to without_continuation' do it 'change state to sans_suite' do
subject subject
dossier.reload dossier.reload
expect(dossier.state).to eq('without_continuation') expect(dossier.state).to eq('sans_suite')
end end
it 'Notification email is sent' do it 'Notification email is sent' do

View file

@ -143,11 +143,11 @@ describe NewGestionnaire::DossiersController, type: :controller do
subject { post :terminer, params: { process_action: "classer_sans_suite", procedure_id: procedure.id, dossier_id: dossier.id} } subject { post :terminer, params: { process_action: "classer_sans_suite", procedure_id: procedure.id, dossier_id: dossier.id} }
it 'change state to without_continuation' do it 'change state to sans_suite' do
subject subject
dossier.reload dossier.reload
expect(dossier.state).to eq('without_continuation') expect(dossier.state).to eq('sans_suite')
end end
it 'Notification email is sent' do it 'Notification email is sent' do

View file

@ -139,7 +139,7 @@ describe NewGestionnaire::ProceduresController, type: :controller do
before do before do
create(:dossier, procedure: procedure, state: "en_construction") create(:dossier, procedure: procedure, state: "en_construction")
create(:dossier, procedure: procedure, state: "en_instruction") create(:dossier, procedure: procedure, state: "en_instruction")
create(:dossier, procedure: procedure, state: "without_continuation", archived: true) create(:dossier, procedure: procedure, state: "sans_suite", archived: true)
gestionnaire.procedures << procedure2 gestionnaire.procedures << procedure2
create(:dossier, :followed, procedure: procedure2, state: "en_construction") create(:dossier, :followed, procedure: procedure2, state: "en_construction")

View file

@ -42,8 +42,8 @@ describe DossierDecorator do
expect(subject).to eq('En instruction') expect(subject).to eq('En instruction')
end end
it 'without_continuation is traité' do it 'sans_suite is traité' do
dossier.without_continuation! dossier.sans_suite!
expect(subject).to eq('Sans suite') expect(subject).to eq('Sans suite')
end end

View file

@ -10,7 +10,7 @@ feature 'on click on tabs button' do
create(:dossier, :with_entreprise, user: user, state: 'en_instruction') create(:dossier, :with_entreprise, user: user, state: 'en_instruction')
create(:dossier, :with_entreprise, user: user, state: 'accepte') create(:dossier, :with_entreprise, user: user, state: 'accepte')
create(:dossier, :with_entreprise, user: user, state: 'refuse') create(:dossier, :with_entreprise, user: user, state: 'refuse')
create(:dossier, :with_entreprise, user: user, state: 'without_continuation') create(:dossier, :with_entreprise, user: user, state: 'sans_suite')
create :invite, dossier: dossier_invite, user: user create :invite, dossier: dossier_invite, user: user

View file

@ -25,7 +25,7 @@ RSpec.describe AutoArchiveProcedureJob, type: :job do
let!(:dossier5) { create(:dossier, procedure: procedure_hier, state: 'en_instruction', archived: false)} let!(:dossier5) { create(:dossier, procedure: procedure_hier, state: 'en_instruction', archived: false)}
let!(:dossier6) { create(:dossier, procedure: procedure_hier, state: 'accepte', archived: false)} let!(:dossier6) { create(:dossier, procedure: procedure_hier, state: 'accepte', archived: false)}
let!(:dossier7) { create(:dossier, procedure: procedure_hier, state: 'refuse', archived: false)} let!(:dossier7) { create(:dossier, procedure: procedure_hier, state: 'refuse', archived: false)}
let!(:dossier8) { create(:dossier, procedure: procedure_hier, state: 'without_continuation', archived: false)} let!(:dossier8) { create(:dossier, procedure: procedure_hier, state: 'sans_suite', archived: false)}
let!(:dossier9) { create(:dossier, procedure: procedure_aujourdhui, state: 'en_construction', archived: false)} let!(:dossier9) { create(:dossier, procedure: procedure_aujourdhui, state: 'en_construction', archived: false)}
before do before do
@ -46,7 +46,7 @@ RSpec.describe AutoArchiveProcedureJob, type: :job do
it { expect(dossier5.state).to eq 'en_instruction' } it { expect(dossier5.state).to eq 'en_instruction' }
it { expect(dossier6.state).to eq 'accepte' } it { expect(dossier6.state).to eq 'accepte' }
it { expect(dossier7.state).to eq 'refuse' } it { expect(dossier7.state).to eq 'refuse' }
it { expect(dossier8.state).to eq 'without_continuation' } it { expect(dossier8.state).to eq 'sans_suite' }
it { expect(dossier9.state).to eq 'en_instruction' } it { expect(dossier9.state).to eq 'en_instruction' }
it { expect(procedure_hier.archivee?).to eq true } it { expect(procedure_hier.archivee?).to eq true }

View file

@ -258,9 +258,9 @@ describe Dossier do
end end
end end
context 'when dossier is at state without_continuation' do context 'when dossier is at state sans_suite' do
before do before do
dossier.without_continuation! dossier.sans_suite!
end end
context 'when user is connected' do context 'when user is connected' do
@ -269,7 +269,7 @@ describe Dossier do
context 'when he posts a comment' do context 'when he posts a comment' do
let(:action) { 'comment' } let(:action) { 'comment' }
it { is_expected.to eq('without_continuation') } it { is_expected.to eq('sans_suite') }
end end
end end
@ -279,7 +279,7 @@ describe Dossier do
context 'when he posts a comment' do context 'when he posts a comment' do
let(:action) { 'comment' } let(:action) { 'comment' }
it { is_expected.to eq('without_continuation') } it { is_expected.to eq('sans_suite') }
end end
end end
end end
@ -751,10 +751,10 @@ describe Dossier do
it_behaves_like 'dossier is processed', 'refuse' it_behaves_like 'dossier is processed', 'refuse'
end end
context 'when dossier is without_continuation' do context 'when dossier is sans_suite' do
let(:state) { 'en_instruction' } let(:state) { 'en_instruction' }
it_behaves_like 'dossier is processed', 'without_continuation' it_behaves_like 'dossier is processed', 'sans_suite'
end end
end end
@ -809,7 +809,7 @@ describe Dossier do
expect { Dossier.create(procedure: procedure, state: "en_instruction", user: user) }.not_to change(ActionMailer::Base.deliveries, :size) expect { Dossier.create(procedure: procedure, state: "en_instruction", user: user) }.not_to change(ActionMailer::Base.deliveries, :size)
expect { Dossier.create(procedure: procedure, state: "accepte", user: user) }.not_to change(ActionMailer::Base.deliveries, :size) expect { Dossier.create(procedure: procedure, state: "accepte", user: user) }.not_to change(ActionMailer::Base.deliveries, :size)
expect { Dossier.create(procedure: procedure, state: "refuse", user: user) }.not_to change(ActionMailer::Base.deliveries, :size) expect { Dossier.create(procedure: procedure, state: "refuse", user: user) }.not_to change(ActionMailer::Base.deliveries, :size)
expect { Dossier.create(procedure: procedure, state: "without_continuation", user: user) }.not_to change(ActionMailer::Base.deliveries, :size) expect { Dossier.create(procedure: procedure, state: "sans_suite", user: user) }.not_to change(ActionMailer::Base.deliveries, :size)
end end
end end

View file

@ -27,5 +27,11 @@ describe DossierSerializer do
it { is_expected.to include(state: 'refused') } it { is_expected.to include(state: 'refused') }
end end
context 'when the dossier is sans_suite' do
let(:dossier) { create(:dossier, state: :sans_suite) }
it { is_expected.to include(state: 'without_continuation') }
end
end end
end end

View file

@ -29,6 +29,12 @@ describe DossierTableExportSerializer do
it { is_expected.to include(state: 'refused') } it { is_expected.to include(state: 'refused') }
end end
context 'when the dossier is sans_suite' do
let(:dossier) { create(:dossier, state: :sans_suite) }
it { is_expected.to include(state: 'without_continuation') }
end
end end
describe '#emails_accompagnateurs' do describe '#emails_accompagnateurs' do

View file

@ -352,7 +352,7 @@ describe DossiersListGestionnaireService do
let!(:dossier7) { create(:dossier, procedure: procedure, state: 'en_instruction') } #a_instruire let!(:dossier7) { create(:dossier, procedure: procedure, state: 'en_instruction') } #a_instruire
let!(:dossier8) { create(:dossier, procedure: procedure, state: 'accepte') } #termine let!(:dossier8) { create(:dossier, procedure: procedure, state: 'accepte') } #termine
let!(:dossier9) { create(:dossier, procedure: procedure, state: 'refuse') } #termine let!(:dossier9) { create(:dossier, procedure: procedure, state: 'refuse') } #termine
let!(:dossier10) { create(:dossier, procedure: procedure, state: 'without_continuation') } #termine let!(:dossier10) { create(:dossier, procedure: procedure, state: 'sans_suite') } #termine
let!(:dossier11) { create(:dossier, procedure: procedure, state: 'accepte') } #termine let!(:dossier11) { create(:dossier, procedure: procedure, state: 'accepte') } #termine
let!(:dossier12) { create(:dossier, procedure: procedure, state: 'en_construction', archived: true) } #a_traiter #archived let!(:dossier12) { create(:dossier, procedure: procedure, state: 'en_construction', archived: true) } #a_traiter #archived
let!(:dossier14) { create(:dossier, procedure: procedure, state: 'accepte', archived: true) } #termine #archived let!(:dossier14) { create(:dossier, procedure: procedure, state: 'accepte', archived: true) } #termine #archived

View file

@ -10,7 +10,7 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
let!(:decorate_dossier_en_instruction) { create(:dossier, :with_entreprise, procedure: procedure, state: 'en_instruction').decorate } let!(:decorate_dossier_en_instruction) { create(:dossier, :with_entreprise, procedure: procedure, state: 'en_instruction').decorate }
let!(:decorate_dossier_accepte) { create(:dossier, :with_entreprise, procedure: procedure, state: 'accepte').decorate } let!(:decorate_dossier_accepte) { create(:dossier, :with_entreprise, procedure: procedure, state: 'accepte').decorate }
let!(:decorate_dossier_refuse) { create(:dossier, :with_entreprise, procedure: procedure, state: 'refuse').decorate } let!(:decorate_dossier_refuse) { create(:dossier, :with_entreprise, procedure: procedure, state: 'refuse').decorate }
let!(:decorate_dossier_without_continuation) { create(:dossier, :with_entreprise, procedure: procedure, state: 'without_continuation').decorate } let!(:decorate_dossier_sans_suite) { create(:dossier, :with_entreprise, procedure: procedure, state: 'sans_suite').decorate }
let(:dossiers_list_facade) { DossiersListFacades.new gestionnaire, nil } let(:dossiers_list_facade) { DossiersListFacades.new gestionnaire, nil }
@ -22,7 +22,7 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
decorate_dossier_en_instruction.entreprise.update_column(:raison_sociale, 'plup') decorate_dossier_en_instruction.entreprise.update_column(:raison_sociale, 'plup')
decorate_dossier_accepte.entreprise.update_column(:raison_sociale, 'plyp') decorate_dossier_accepte.entreprise.update_column(:raison_sociale, 'plyp')
decorate_dossier_refuse.entreprise.update_column(:raison_sociale, 'plzp') decorate_dossier_refuse.entreprise.update_column(:raison_sociale, 'plzp')
decorate_dossier_without_continuation.entreprise.update_column(:raison_sociale, 'plnp') decorate_dossier_sans_suite.entreprise.update_column(:raison_sociale, 'plnp')
create :preference_list_dossier, create :preference_list_dossier,
gestionnaire: gestionnaire, gestionnaire: gestionnaire,

View file

@ -72,8 +72,8 @@ describe 'layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.htm
end end
end end
context 'when dossier have state without_continuation' do context 'when dossier have state sans_suite' do
let(:state) { 'without_continuation' } let(:state) { 'sans_suite' }
before do before do
render render

View file

@ -48,8 +48,8 @@ describe 'layouts/left_panels/_left_panel_users_recapitulatifcontroller_show.htm
end end
end end
context 'when dossier state is without_continuation' do context 'when dossier state is sans_suite' do
let(:state) { 'without_continuation' } let(:state) { 'sans_suite' }
before do before do
render render

View file

@ -7,7 +7,7 @@ describe 'users/dossiers/index.html.haml', type: :view do
let!(:decorate_dossier_en_instruction) { create(:dossier, :with_entreprise, user: user, state: 'en_instruction').decorate } let!(:decorate_dossier_en_instruction) { create(:dossier, :with_entreprise, user: user, state: 'en_instruction').decorate }
let!(:decorate_dossier_accepte) { create(:dossier, :with_entreprise, user: user, state: 'accepte').decorate } let!(:decorate_dossier_accepte) { create(:dossier, :with_entreprise, user: user, state: 'accepte').decorate }
let!(:decorate_dossier_refuse) { create(:dossier, :with_entreprise, user: user, state: 'refuse').decorate } let!(:decorate_dossier_refuse) { create(:dossier, :with_entreprise, user: user, state: 'refuse').decorate }
let!(:decorate_dossier_without_continuation) { create(:dossier, :with_entreprise, user: user, state: 'without_continuation').decorate } let!(:decorate_dossier_sans_suite) { create(:dossier, :with_entreprise, user: user, state: 'sans_suite').decorate }
let!(:decorate_dossier_invite) { create(:dossier, :with_entreprise, user: create(:user), state: 'en_construction').decorate } let!(:decorate_dossier_invite) { create(:dossier, :with_entreprise, user: create(:user), state: 'en_construction').decorate }
before do before do
@ -75,7 +75,7 @@ describe 'users/dossiers/index.html.haml', type: :view do
end end
it_behaves_like 'check_tab_content' do it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_without_continuation } let(:decorate_dossier_at_check) { decorate_dossier_sans_suite }
end end
end end