[fix #504] Dossier: draft -> brouillon
This commit is contained in:
parent
56545933a9
commit
72bae2c374
34 changed files with 93 additions and 89 deletions
|
@ -5,7 +5,7 @@ class StatsController < ApplicationController
|
|||
|
||||
def index
|
||||
procedures = Procedure.publiees_ou_archivees
|
||||
dossiers = Dossier.where.not(:state => :draft)
|
||||
dossiers = Dossier.where.not(:state => :brouillon)
|
||||
|
||||
@procedures_count = procedures.count
|
||||
@dossiers_count = dossiers.count
|
||||
|
|
|
@ -25,7 +25,7 @@ class Users::CarteController < UsersController
|
|||
dossier.update_attributes(json_latlngs: params[:json_latlngs])
|
||||
|
||||
controller = :recapitulatif
|
||||
controller = :description if dossier.draft?
|
||||
controller = :description if dossier.brouillon?
|
||||
|
||||
redirect_to url_for(controller: controller, action: :show, dossier_id: params[:dossier_id])
|
||||
end
|
||||
|
@ -61,7 +61,7 @@ class Users::CarteController < UsersController
|
|||
|
||||
def self.route_authorization
|
||||
{
|
||||
states: [:draft, :en_construction],
|
||||
states: [:brouillon, :en_construction],
|
||||
api_carto: true
|
||||
}
|
||||
end
|
||||
|
|
|
@ -39,18 +39,18 @@ class Users::DescriptionController < UsersController
|
|||
errors_upload = PiecesJustificativesService.upload!(dossier, current_user, params)
|
||||
return redirect_to_description_with_errors(dossier, errors_upload) if errors_upload.any?
|
||||
|
||||
if params[:champs] && !draft_submission?
|
||||
if params[:champs] && !brouillon_submission?
|
||||
errors =
|
||||
ChampsService.build_error_messages(dossier.champs) +
|
||||
PiecesJustificativesService.missing_pj_error_messages(dossier)
|
||||
return redirect_to_description_with_errors(dossier, errors) if errors.any?
|
||||
end
|
||||
|
||||
if draft_submission?
|
||||
if brouillon_submission?
|
||||
flash.notice = 'Votre brouillon a bien été sauvegardé.'
|
||||
redirect_to url_for(controller: :dossiers, action: :index, liste: :brouillon)
|
||||
else
|
||||
if dossier.draft?
|
||||
if dossier.brouillon?
|
||||
NotificationMailer.send_notification(dossier, procedure.initiated_mail_template).deliver_now!
|
||||
dossier.en_construction!
|
||||
end
|
||||
|
@ -93,7 +93,7 @@ class Users::DescriptionController < UsersController
|
|||
|
||||
def self.route_authorization
|
||||
{
|
||||
states: [:draft, :en_construction]
|
||||
states: [:brouillon, :en_construction]
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -110,7 +110,7 @@ class Users::DescriptionController < UsersController
|
|||
redirect_to users_dossier_description_path(dossier_id: dossier.id)
|
||||
end
|
||||
|
||||
def draft_submission?
|
||||
def brouillon_submission?
|
||||
params[:submit] && params[:submit].keys.first == 'brouillon'
|
||||
end
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ class Users::DossiersController < UsersController
|
|||
def new
|
||||
procedure = Procedure.publiees.find(params[:procedure_id])
|
||||
|
||||
dossier = Dossier.create(procedure: procedure, user: current_user, state: 'draft')
|
||||
dossier = Dossier.create(procedure: procedure, user: current_user, state: 'brouillon')
|
||||
siret = params[:siret] || current_user.siret
|
||||
|
||||
update_current_user_siret! siret unless siret.nil?
|
||||
|
@ -151,7 +151,7 @@ class Users::DossiersController < UsersController
|
|||
|
||||
def self.route_authorization
|
||||
{
|
||||
states: [:draft]
|
||||
states: [:brouillon]
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ class Cerfa < ActiveRecord::Base
|
|||
private
|
||||
|
||||
def internal_notification
|
||||
unless dossier.state == 'draft'
|
||||
unless dossier.state == 'brouillon'
|
||||
NotificationService.new('cerfa', self.dossier.id).notify
|
||||
end
|
||||
end
|
||||
|
|
|
@ -117,7 +117,7 @@ class Champ < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def internal_notification
|
||||
if dossier.state != 'draft'
|
||||
if dossier.state != 'brouillon'
|
||||
if type == 'ChampPublic'
|
||||
NotificationService.new('champs', self.dossier.id, self.libelle).notify
|
||||
else
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class Dossier < ActiveRecord::Base
|
||||
enum state: {
|
||||
draft: 'draft',
|
||||
brouillon: 'brouillon',
|
||||
en_construction: 'en_construction',
|
||||
received: 'received',
|
||||
closed: 'closed',
|
||||
|
@ -8,7 +8,7 @@ class Dossier < ActiveRecord::Base
|
|||
without_continuation: 'without_continuation'
|
||||
}
|
||||
|
||||
BROUILLON = %w(draft)
|
||||
BROUILLON = %w(brouillon)
|
||||
NOUVEAUX = %w(en_construction)
|
||||
EN_CONSTRUCTION = %w(en_construction)
|
||||
EN_INSTRUCTION = %w(received)
|
||||
|
@ -157,7 +157,7 @@ class Dossier < ActiveRecord::Base
|
|||
when 'user'
|
||||
case action
|
||||
when 'initiate'
|
||||
if draft?
|
||||
if brouillon?
|
||||
en_construction!
|
||||
end
|
||||
end
|
||||
|
@ -295,7 +295,7 @@ class Dossier < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def can_be_en_construction?
|
||||
!(procedure.archivee? && draft?)
|
||||
!(procedure.archivee? && brouillon?)
|
||||
end
|
||||
|
||||
def text_summary
|
||||
|
|
|
@ -59,7 +59,7 @@ class PieceJustificative < ActiveRecord::Base
|
|||
private
|
||||
|
||||
def internal_notification
|
||||
unless self.type_de_piece_justificative.nil? && dossier.state == 'draft'
|
||||
unless self.type_de_piece_justificative.nil? && dossier.state == 'brouillon'
|
||||
NotificationService.new('piece_justificative', self.dossier.id, self.libelle).notify
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
.col-xs-8.title-no-expanse
|
||||
.carret-right
|
||||
INFORMATIONS DU DEMANDEUR
|
||||
- if !@current_gestionnaire && ["draft", "en_construction"].include?(@facade.dossier.state)
|
||||
- if !@current_gestionnaire && ["brouillon", "en_construction"].include?(@facade.dossier.state)
|
||||
%a#add_siret.action{ href: users_dossier_add_siret_path(dossier_id: @facade.dossier.id) }
|
||||
.col-lg-4.col-md-4.col-sm-4.col-xs-4.action
|
||||
Renseigner un SIRET
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
dématérialisées
|
||||
%li.number
|
||||
.number-value
|
||||
= number_with_delimiter(Dossier.where.not(:state => :draft).count, :locale => :fr)
|
||||
= number_with_delimiter(Dossier.where.not(:state => :brouillon).count, :locale => :fr)
|
||||
.number-label<
|
||||
dossiers
|
||||
%br<>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
%input#quartier_prioritaires{ type: 'hidden', value: "#{@dossier.quartier_prioritaires.to_json}" }
|
||||
%input#cadastres{ type: 'hidden', value: "#{@dossier.cadastres.to_json}" }
|
||||
|
||||
- if @dossier.draft?
|
||||
- if @dossier.brouillon?
|
||||
= render partial: '/layouts/etape_suivante'
|
||||
- else
|
||||
= render partial: '/layouts/modifications_terminees'
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
- if !@dossier.can_be_en_construction?
|
||||
.alert.alert-danger
|
||||
= t('errors.messages.procedure_archived')
|
||||
- elsif !@dossier.draft?
|
||||
- elsif !@dossier.brouillon?
|
||||
= render partial: '/layouts/modifications_terminees'
|
||||
- else
|
||||
= submit_tag 'Soumettre mon dossier', id: 'suivant', name: 'submit[nouveaux]', class: 'btn btn btn-success', style: 'float: right;', disabled: @procedure.archivee?, data: { disable_with: 'Soumettre votre dossier', submit: true }
|
||||
|
|
|
@ -8,7 +8,7 @@ fr:
|
|||
montant_aide_demande: "Le montant d'aide demandée"
|
||||
date_previsionnelle: "La date de début prévisionnelle"
|
||||
state:
|
||||
draft: "Brouillon"
|
||||
brouillon: "Brouillon"
|
||||
en_construction: "En construction"
|
||||
received: "En instruction"
|
||||
closed: "Accepté"
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
namespace :'2017_12_04_translate_dossier_state_to_french' do
|
||||
task brouillon: :environment do
|
||||
Dossier.unscoped.where(state: 'draft').update_all(state: 'brouillon')
|
||||
end
|
||||
|
||||
task en_construction: :environment do
|
||||
Dossier.unscoped.where(state: 'initiated').update_all(state: 'en_construction')
|
||||
end
|
||||
|
|
|
@ -121,8 +121,8 @@ describe NewGestionnaire::ProceduresController, type: :controller do
|
|||
dossier
|
||||
end
|
||||
|
||||
context "with draft state" do
|
||||
let(:state) { "draft" }
|
||||
context "with brouillon state" do
|
||||
let(:state) { "brouillon" }
|
||||
before { subject }
|
||||
|
||||
it { expect(assigns(:dossiers_count_per_procedure)[procedure.id]).to eq(nil) }
|
||||
|
@ -181,8 +181,8 @@ describe NewGestionnaire::ProceduresController, type: :controller do
|
|||
it { expect(assigns(:procedure)).to eq(procedure) }
|
||||
end
|
||||
|
||||
context 'with a new draft dossier' do
|
||||
let!(:draft_dossier) { create(:dossier, procedure: procedure, state: 'draft') }
|
||||
context 'with a new brouillon dossier' do
|
||||
let!(:brouillon_dossier) { create(:dossier, procedure: procedure, state: 'draft') }
|
||||
|
||||
before do
|
||||
get :show, params: { procedure_id: procedure.id }
|
||||
|
|
|
@ -166,7 +166,7 @@ describe StatsController, type: :controller do
|
|||
}
|
||||
end
|
||||
|
||||
let (:association) { Dossier.where.not(:state => :draft) }
|
||||
let (:association) { Dossier.where.not(:state => :brouillon) }
|
||||
|
||||
subject { StatsController.new.send(:dossier_instruction_mean_time, association) }
|
||||
|
||||
|
@ -218,7 +218,7 @@ describe StatsController, type: :controller do
|
|||
}
|
||||
end
|
||||
|
||||
let (:association) { Dossier.where.not(:state => :draft) }
|
||||
let (:association) { Dossier.where.not(:state => :brouillon) }
|
||||
|
||||
subject { StatsController.new.send(:dossier_filling_mean_time, association) }
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ shared_examples 'description_controller_spec' do
|
|||
it { expect(response).to have_http_status(:success) }
|
||||
it { expect(response.body).to_not have_content(I18n.t('errors.messages.procedure_archived')) }
|
||||
|
||||
context 'dossier is a draft' do
|
||||
let(:state) { 'draft' }
|
||||
context 'dossier is a brouillon' do
|
||||
let(:state) { 'brouillon' }
|
||||
|
||||
it { expect(response).to have_http_status(:success) }
|
||||
it { expect(response.body).to have_content(I18n.t('errors.messages.procedure_archived')) }
|
||||
|
@ -115,7 +115,7 @@ shared_examples 'description_controller_spec' do
|
|||
subject { post :update, params: {dossier_id: dossier_id, submit: submit} }
|
||||
|
||||
before do
|
||||
dossier.draft!
|
||||
dossier.brouillon!
|
||||
subject
|
||||
dossier.reload
|
||||
end
|
||||
|
@ -128,7 +128,7 @@ shared_examples 'description_controller_spec' do
|
|||
expect(dossier.state).to eq('en_construction')
|
||||
end
|
||||
|
||||
context 'when user whould like save just a draft' do
|
||||
context 'when user whould like save just a brouillon' do
|
||||
let(:submit) { {brouillon: 'brouillon'} }
|
||||
|
||||
it "redirection vers la page recapitulative" do
|
||||
|
@ -136,7 +136,7 @@ shared_examples 'description_controller_spec' do
|
|||
end
|
||||
|
||||
it 'etat du dossier est soumis' do
|
||||
expect(dossier.state).to eq('draft')
|
||||
expect(dossier.state).to eq('brouillon')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -153,7 +153,7 @@ shared_examples 'description_controller_spec' do
|
|||
end
|
||||
|
||||
it 'etat du dossier n\'est pas soumis' do
|
||||
expect(dossier.state).not_to eq('draft')
|
||||
expect(dossier.state).not_to eq('brouillon')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -313,7 +313,7 @@ shared_examples 'description_controller_spec' do
|
|||
it { expect(response.status).to eq(302) }
|
||||
|
||||
context 'Le dossier est en brouillon' do
|
||||
let(:state) { 'draft' }
|
||||
let(:state) { 'brouillon' }
|
||||
|
||||
it { expect(response.status).to eq(403) }
|
||||
end
|
||||
|
|
|
@ -254,9 +254,9 @@ describe Users::DossiersController, type: :controller do
|
|||
expect(Dossier.last.procedure).to eq(Procedure.last)
|
||||
end
|
||||
|
||||
it 'state of dossier is draft' do
|
||||
it 'state of dossier is brouillon' do
|
||||
subject
|
||||
expect(Dossier.last.state).to eq('draft')
|
||||
expect(Dossier.last.state).to eq('brouillon')
|
||||
end
|
||||
|
||||
describe 'Mandataires Sociaux' do
|
||||
|
@ -434,8 +434,8 @@ describe Users::DossiersController, type: :controller do
|
|||
|
||||
describe 'DELETE #destroy' do
|
||||
let(:user) { create(:user) }
|
||||
let!(:dossier_draft) { create :dossier, state: "draft", user: user }
|
||||
let!(:dossier_not_draft) { create :dossier, state: "en_construction", user: user }
|
||||
let!(:dossier_brouillon) { create :dossier, state: "brouillon", user: user }
|
||||
let!(:dossier_not_brouillon) { create :dossier, state: "en_construction", user: user }
|
||||
|
||||
subject { delete :destroy, params: {id: dossier.id} }
|
||||
|
||||
|
@ -443,8 +443,8 @@ describe Users::DossiersController, type: :controller do
|
|||
sign_in user
|
||||
end
|
||||
|
||||
context 'when dossier is draft' do
|
||||
let(:dossier) { dossier_draft }
|
||||
context 'when dossier is brouillon' do
|
||||
let(:dossier) { dossier_brouillon }
|
||||
|
||||
it { expect(subject.status).to eq 302 }
|
||||
|
||||
|
@ -464,8 +464,8 @@ describe Users::DossiersController, type: :controller do
|
|||
it { expect { subject }.to change { Dossier.count }.by(-1) }
|
||||
end
|
||||
|
||||
context 'when dossier is not a draft' do
|
||||
let(:dossier) { dossier_not_draft }
|
||||
context 'when dossier is not a brouillon' do
|
||||
let(:dossier) { dossier_not_brouillon }
|
||||
|
||||
it { expect { subject }.to change { Dossier.count }.by(0) }
|
||||
end
|
||||
|
|
|
@ -22,9 +22,9 @@ describe Users::RecapitulatifController, type: :controller do
|
|||
it_behaves_like "not owner of dossier", :show
|
||||
|
||||
describe 'before_action authorized_routes?' do
|
||||
context 'when dossier have draft state' do
|
||||
context 'when dossier have brouillon state' do
|
||||
before do
|
||||
dossier.state = 'draft'
|
||||
dossier.state = 'brouillon'
|
||||
dossier.save
|
||||
|
||||
get :show, params: {dossier_id: dossier.id}
|
||||
|
|
|
@ -22,8 +22,8 @@ describe DossierDecorator do
|
|||
describe 'state_fr' do
|
||||
subject{ super().display_state }
|
||||
|
||||
it 'draft is brouillon' do
|
||||
dossier.draft!
|
||||
it 'brouillon is brouillon' do
|
||||
dossier.brouillon!
|
||||
expect(subject).to eq('Brouillon')
|
||||
end
|
||||
|
||||
|
@ -63,7 +63,7 @@ describe DossierDecorator do
|
|||
context "when a gestionnaire is not signed_in" do
|
||||
context "when the dossier is in brouillon state" do
|
||||
before do
|
||||
dossier.state = 'draft'
|
||||
dossier.state = 'brouillon'
|
||||
dossier.save
|
||||
end
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
|||
describe AdminProceduresShowFacades do
|
||||
let!(:procedure) { create(:procedure) }
|
||||
|
||||
let!(:dossier_0) { create(:dossier, procedure: procedure, state: 'draft') }
|
||||
let!(:dossier_0) { create(:dossier, procedure: procedure, state: 'brouillon') }
|
||||
let!(:dossier_1) { create(:dossier, procedure: procedure, state: 'en_construction') }
|
||||
let!(:dossier_2) { create(:dossier, procedure: procedure, state: 'en_construction') }
|
||||
let!(:dossier_6) { create(:dossier, procedure: procedure, archived: true, state: 'en_construction') }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
FactoryGirl.define do
|
||||
factory :dossier do
|
||||
state 'draft'
|
||||
state 'brouillon'
|
||||
association :user, factory: [:user]
|
||||
|
||||
before(:create) do |dossier, _evaluator|
|
||||
|
|
|
@ -18,7 +18,7 @@ RSpec.describe AutoArchiveProcedureJob, type: :job do
|
|||
end
|
||||
|
||||
context "when procedures have auto_archive_on set on yesterday or today" do
|
||||
let!(:dossier1) { create(:dossier, procedure: procedure_hier, state: 'draft', archived: false)}
|
||||
let!(:dossier1) { create(:dossier, procedure: procedure_hier, state: 'brouillon', archived: false)}
|
||||
let!(:dossier2) { create(:dossier, procedure: procedure_hier, state: 'en_construction', archived: false)}
|
||||
let!(:dossier3) { create(:dossier, procedure: procedure_hier, state: 'en_construction', archived: false)}
|
||||
let!(:dossier4) { create(:dossier, procedure: procedure_hier, state: 'en_construction', archived: false)}
|
||||
|
@ -39,7 +39,7 @@ RSpec.describe AutoArchiveProcedureJob, type: :job do
|
|||
procedure_aujourdhui.reload
|
||||
end
|
||||
|
||||
it { expect(dossier1.state).to eq 'draft' }
|
||||
it { expect(dossier1.state).to eq 'brouillon' }
|
||||
it { expect(dossier2.state).to eq 'received' }
|
||||
it { expect(dossier3.state).to eq 'received' }
|
||||
it { expect(dossier4.state).to eq 'received' }
|
||||
|
|
|
@ -13,8 +13,8 @@ RSpec.describe AutoReceiveDossiersForProcedureJob, type: :job do
|
|||
let(:nouveau_dossier1) { create(:dossier, :en_construction) }
|
||||
let(:nouveau_dossier2) { create(:dossier, :en_construction, procedure: nouveau_dossier1.procedure) }
|
||||
let(:dossier_recu) { create(:dossier, :received, procedure: nouveau_dossier2.procedure) }
|
||||
let(:dossier_draft) { create(:dossier, procedure: dossier_recu.procedure) }
|
||||
let(:procedure_id) { dossier_draft.procedure_id }
|
||||
let(:dossier_brouillon) { create(:dossier, procedure: dossier_recu.procedure) }
|
||||
let(:procedure_id) { dossier_brouillon.procedure_id }
|
||||
|
||||
it do
|
||||
subject
|
||||
|
@ -27,8 +27,8 @@ RSpec.describe AutoReceiveDossiersForProcedureJob, type: :job do
|
|||
expect(dossier_recu.reload.received?).to be true
|
||||
expect(dossier_recu.reload.received_at).to eq(date)
|
||||
|
||||
expect(dossier_draft.reload.draft?).to be true
|
||||
expect(dossier_draft.reload.received_at).to eq(nil)
|
||||
expect(dossier_brouillon.reload.brouillon?).to be true
|
||||
expect(dossier_brouillon.reload.received_at).to eq(nil)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -134,9 +134,9 @@ describe Dossier do
|
|||
it { expect { subject }.to raise_error('role is not valid') }
|
||||
end
|
||||
|
||||
context 'when dossier is at state draft' do
|
||||
context 'when dossier is at state brouillon' do
|
||||
before do
|
||||
dossier.draft!
|
||||
dossier.brouillon!
|
||||
end
|
||||
|
||||
context 'when user is connected' do
|
||||
|
@ -145,13 +145,13 @@ describe Dossier do
|
|||
context 'when he updates dossier informations' do
|
||||
let(:action) { 'update' }
|
||||
|
||||
it { is_expected.to eq('draft') }
|
||||
it { is_expected.to eq('brouillon') }
|
||||
end
|
||||
|
||||
context 'when he posts a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it { is_expected.to eq('draft') }
|
||||
it { is_expected.to eq('brouillon') }
|
||||
end
|
||||
|
||||
context 'when he initiate a dossier' do
|
||||
|
@ -421,7 +421,7 @@ describe Dossier do
|
|||
it { expect(subject[3]).to be_in([true, false]) }
|
||||
it { expect(subject[4]).to eq(dossier.user.email) }
|
||||
it { expect(subject[5]).to be_in([true, false]) }
|
||||
it { expect(subject[6]).to eq("draft") }
|
||||
it { expect(subject[6]).to eq("brouillon") }
|
||||
it { expect(subject[7]).to eq(date1) }
|
||||
it { expect(subject[8]).to eq(date2) }
|
||||
it { expect(subject[9]).to eq(date3) }
|
||||
|
@ -459,7 +459,7 @@ describe Dossier do
|
|||
"false",
|
||||
dossier.user.email,
|
||||
"false",
|
||||
"draft",
|
||||
"brouillon",
|
||||
dossier.en_construction_at,
|
||||
dossier.received_at,
|
||||
dossier.processed_at,
|
||||
|
@ -624,7 +624,7 @@ describe Dossier do
|
|||
end
|
||||
|
||||
context 'when the dossier has not been en_construction' do
|
||||
let(:dossier) { create :dossier, procedure: procedure, state: 'draft' }
|
||||
let(:dossier) { create :dossier, procedure: procedure, state: 'brouillon' }
|
||||
|
||||
subject { dossier.text_summary }
|
||||
|
||||
|
@ -683,7 +683,7 @@ describe Dossier do
|
|||
end
|
||||
|
||||
describe '#update_state_dates' do
|
||||
let(:state) { 'draft' }
|
||||
let(:state) { 'brouillon' }
|
||||
let(:dossier) { create(:dossier, state: state) }
|
||||
let(:beginning_of_day) { Time.now.beginning_of_day }
|
||||
|
||||
|
@ -760,7 +760,7 @@ describe Dossier do
|
|||
|
||||
describe '.downloadable_sorted' do
|
||||
let(:procedure) { create(:procedure) }
|
||||
let!(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: :draft) }
|
||||
let!(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: :brouillon) }
|
||||
let!(:dossier2) { create(:dossier, :with_entreprise, procedure: procedure, state: :en_construction, en_construction_at: DateTime.parse('03/01/2010')) }
|
||||
let!(:dossier3) { create(:dossier, :with_entreprise, procedure: procedure, state: :received, en_construction_at: DateTime.parse('01/01/2010')) }
|
||||
let!(:dossier4) { create(:dossier, :with_entreprise, procedure: procedure, state: :received, archived: true, en_construction_at: DateTime.parse('02/01/2010')) }
|
||||
|
@ -798,13 +798,13 @@ describe Dossier do
|
|||
end
|
||||
|
||||
it "send an email when the dossier is created for the very first time" do
|
||||
expect { Dossier.create(procedure: procedure, state: "draft", user: user) }.to change(ActionMailer::Base.deliveries, :size).from(0).to(1)
|
||||
expect { Dossier.create(procedure: procedure, state: "brouillon", user: user) }.to change(ActionMailer::Base.deliveries, :size).from(0).to(1)
|
||||
|
||||
mail = ActionMailer::Base.deliveries.last
|
||||
expect(mail.subject).to eq("Retrouvez votre brouillon pour la démarche : #{procedure.libelle}")
|
||||
end
|
||||
|
||||
it "does not send an email when the dossier is created with a non draft state" do
|
||||
it "does not send an email when the dossier is created with a non brouillon state" do
|
||||
expect { Dossier.create(procedure: procedure, state: "en_construction", user: user) }.not_to change(ActionMailer::Base.deliveries, :size)
|
||||
expect { Dossier.create(procedure: procedure, state: "received", user: user) }.not_to change(ActionMailer::Base.deliveries, :size)
|
||||
expect { Dossier.create(procedure: procedure, state: "closed", user: user) }.not_to change(ActionMailer::Base.deliveries, :size)
|
||||
|
|
|
@ -45,8 +45,8 @@ describe ProcedureOverview, type: :model do
|
|||
create(:dossier, procedure: procedure, created_at: monday, state: :received)
|
||||
end
|
||||
|
||||
let!(:created_dossier_during_the_week_but_in_draft) do
|
||||
create(:dossier, procedure: procedure, created_at: monday, state: :draft)
|
||||
let!(:created_dossier_during_the_week_but_in_brouillon) do
|
||||
create(:dossier, procedure: procedure, created_at: monday, state: :brouillon)
|
||||
end
|
||||
|
||||
let!(:created_dossier_before_the_week) do
|
||||
|
|
|
@ -308,7 +308,7 @@ describe Procedure do
|
|||
|
||||
before do
|
||||
create :dossier, procedure: procedure, state: :en_construction
|
||||
create :dossier, procedure: procedure, state: :draft
|
||||
create :dossier, procedure: procedure, state: :brouillon
|
||||
create :dossier, procedure: procedure, state: :en_construction
|
||||
end
|
||||
|
||||
|
@ -371,8 +371,8 @@ describe Procedure do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when there is a draft dossier' do
|
||||
let!(:dossier_not_exportable){ create(:dossier, procedure: procedure, state: 'draft') }
|
||||
context 'when there is a brouillon dossier' do
|
||||
let!(:dossier_not_exportable){ create(:dossier, procedure: procedure, state: 'brouillon') }
|
||||
|
||||
it_behaves_like "export is empty"
|
||||
end
|
||||
|
|
|
@ -22,7 +22,7 @@ describe Search do
|
|||
let(:procedure_1) { create(:procedure, :published, administrateur: administrateur_1) }
|
||||
let(:procedure_2) { create(:procedure, :published, administrateur: administrateur_2) }
|
||||
|
||||
let!(:dossier_0) { create(:dossier, state: 'draft', procedure: procedure_1, user: create(:user, email: 'brouillon@clap.fr')) }
|
||||
let!(:dossier_0) { create(:dossier, state: 'brouillon', procedure: procedure_1, user: create(:user, email: 'brouillon@clap.fr')) }
|
||||
let!(:dossier_1) { create(:dossier, state: 'en_construction', procedure: procedure_1, user: create(:user, email: 'contact@test.com')) }
|
||||
let!(:dossier_2) { create(:dossier, state: 'en_construction', procedure: procedure_1, user: create(:user, email: 'plop@gmail.com')) }
|
||||
let!(:dossier_3) { create(:dossier, state: 'en_construction', procedure: procedure_2, user: create(:user, email: 'peace@clap.fr')) }
|
||||
|
@ -38,7 +38,7 @@ describe Search do
|
|||
it { expect(subject.size).to eq(0) }
|
||||
end
|
||||
|
||||
describe 'search draft file' do
|
||||
describe 'search brouillon file' do
|
||||
let(:terms) { 'brouillon' }
|
||||
|
||||
it { expect(subject.size).to eq(0) }
|
||||
|
|
|
@ -345,7 +345,7 @@ describe DossiersListGestionnaireService do
|
|||
|
||||
describe 'state filter methods' do
|
||||
let!(:procedure) { create :procedure }
|
||||
let!(:dossier) { create(:dossier, procedure: procedure, state: 'draft') }
|
||||
let!(:dossier) { create(:dossier, procedure: procedure, state: 'brouillon') }
|
||||
let!(:dossier2) { create(:dossier, procedure: procedure, state: 'en_construction') } #nouveaux
|
||||
let!(:dossier3) { create(:dossier, procedure: procedure, state: 'en_construction') } #nouveaux
|
||||
let!(:dossier6) { create(:dossier, procedure: procedure, state: 'received') } #a_instruire
|
||||
|
|
|
@ -13,8 +13,8 @@ describe UserRoutesAuthorizationService do
|
|||
describe 'Users::DossiersController' do
|
||||
let(:controller) { Users::DossiersController }
|
||||
|
||||
describe 'draft' do
|
||||
let(:state) { 'draft' }
|
||||
describe 'brouillon' do
|
||||
let(:state) { 'brouillon' }
|
||||
it { is_expected.to be_truthy }
|
||||
end
|
||||
|
||||
|
@ -33,8 +33,8 @@ describe UserRoutesAuthorizationService do
|
|||
let(:controller) { Users::CarteController }
|
||||
|
||||
context 'when use_api_carto is false' do
|
||||
describe 'draft' do
|
||||
let(:state) { 'draft' }
|
||||
describe 'brouillon' do
|
||||
let(:state) { 'brouillon' }
|
||||
it { is_expected.to be_falsey }
|
||||
end
|
||||
|
||||
|
@ -52,8 +52,8 @@ describe UserRoutesAuthorizationService do
|
|||
context 'when use_api_carto is true' do
|
||||
let(:use_api_carto) { true }
|
||||
|
||||
describe 'draft' do
|
||||
let(:state) { 'draft' }
|
||||
describe 'brouillon' do
|
||||
let(:state) { 'brouillon' }
|
||||
it { is_expected.to be_truthy }
|
||||
end
|
||||
|
||||
|
@ -72,8 +72,8 @@ describe UserRoutesAuthorizationService do
|
|||
describe 'Users::DescriptionController' do
|
||||
let(:controller) { Users::DescriptionController }
|
||||
|
||||
describe 'draft' do
|
||||
let(:state) { 'draft' }
|
||||
describe 'brouillon' do
|
||||
let(:state) { 'brouillon' }
|
||||
it { is_expected.to be_truthy }
|
||||
end
|
||||
|
||||
|
@ -91,8 +91,8 @@ describe UserRoutesAuthorizationService do
|
|||
describe 'recapitulatif' do
|
||||
let(:controller) { Users::RecapitulatifController }
|
||||
|
||||
describe 'draft' do
|
||||
let(:state) { 'draft' }
|
||||
describe 'brouillon' do
|
||||
let(:state) { 'brouillon' }
|
||||
it { is_expected.to be_falsey }
|
||||
end
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
|||
|
||||
describe 'layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.html.haml', type: :view do
|
||||
let!(:dossier) { create(:dossier, :with_entreprise, state: state, archived: archived) }
|
||||
let(:state) { 'draft' }
|
||||
let(:state) { 'brouillon' }
|
||||
let(:archived) { false }
|
||||
let(:gestionnaire) { create(:gestionnaire) }
|
||||
let!(:assign_to) { create(:assign_to, gestionnaire: gestionnaire, procedure: dossier.procedure) }
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
|||
describe 'layouts/left_panels/_left_panel_users_recapitulatifcontroller_show.html.haml', type: :view do
|
||||
let(:dossier) { create(:dossier, :with_entreprise, state: state, procedure: create(:procedure, :with_api_carto, :with_two_type_de_piece_justificative, for_individual: true, individual_with_siret: true)) }
|
||||
let(:dossier_id) { dossier.id }
|
||||
let(:state) { 'draft' }
|
||||
let(:state) { 'brouillon' }
|
||||
|
||||
before do
|
||||
sign_in dossier.user
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'users/carte/show.html.haml', type: :view do
|
||||
let(:state) { 'draft' }
|
||||
let(:state) { 'brouillon' }
|
||||
let(:dossier) { create(:dossier, state: state) }
|
||||
let(:dossier_id) { dossier.id }
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
|||
describe 'users/recapitulatif/show.html.haml', type: :view do
|
||||
let(:dossier) { create(:dossier, :with_entreprise, state: state, procedure: create(:procedure, :with_api_carto, :with_two_type_de_piece_justificative, for_individual: true, individual_with_siret: true)) }
|
||||
let(:dossier_id) { dossier.id }
|
||||
let(:state) { 'draft' }
|
||||
let(:state) { 'brouillon' }
|
||||
|
||||
before do
|
||||
sign_in dossier.user
|
||||
|
|
Loading…
Reference in a new issue