Merge pull request #1038 from sgmap/fix_504_translate_dossier_state_in_french
Fix 504 translate dossier state in french
This commit is contained in:
commit
58ce66f457
88 changed files with 678 additions and 493 deletions
|
@ -97,7 +97,7 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
|
|||
def receive
|
||||
dossier = Dossier.find(params[:dossier_id])
|
||||
|
||||
dossier.received!
|
||||
dossier.en_instruction!
|
||||
current_gestionnaire.follow(dossier)
|
||||
flash.notice = 'Dossier passé en instruction.'
|
||||
|
||||
|
@ -179,7 +179,7 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
|
|||
def reopen
|
||||
create_dossier_facade params[:dossier_id]
|
||||
|
||||
@facade.dossier.initiated!
|
||||
@facade.dossier.en_construction!
|
||||
flash.notice = 'Dossier repassé en construction.'
|
||||
|
||||
redirect_to backoffice_dossier_path(id: @facade.dossier.id)
|
||||
|
|
|
@ -61,7 +61,7 @@ module NewGestionnaire
|
|||
end
|
||||
|
||||
def passer_en_instruction
|
||||
dossier.received!
|
||||
dossier.en_instruction!
|
||||
current_gestionnaire.follow(dossier)
|
||||
flash.notice = 'Dossier passé en instruction.'
|
||||
|
||||
|
@ -69,7 +69,7 @@ module NewGestionnaire
|
|||
end
|
||||
|
||||
def repasser_en_construction
|
||||
dossier.initiated!
|
||||
dossier.en_construction!
|
||||
flash.notice = 'Dossier repassé en construction.'
|
||||
|
||||
redirect_to dossier_path(procedure, dossier)
|
||||
|
|
|
@ -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
|
||||
|
@ -13,8 +13,8 @@ class StatsController < ApplicationController
|
|||
@procedures_cumulative = cumulative_hash(procedures, :published_at)
|
||||
@procedures_in_the_last_4_months = last_four_months_hash(procedures, :published_at)
|
||||
|
||||
@dossiers_cumulative = cumulative_hash(dossiers, :initiated_at)
|
||||
@dossiers_in_the_last_4_months = last_four_months_hash(dossiers, :initiated_at)
|
||||
@dossiers_cumulative = cumulative_hash(dossiers, :en_construction_at)
|
||||
@dossiers_in_the_last_4_months = last_four_months_hash(dossiers, :en_construction_at)
|
||||
|
||||
@procedures_count_per_administrateur = procedures_count_per_administrateur(procedures)
|
||||
|
||||
|
@ -96,7 +96,7 @@ class StatsController < ApplicationController
|
|||
|
||||
processed_dossiers = dossiers
|
||||
.where(:processed_at => min_date..max_date)
|
||||
.pluck(:procedure_id, :initiated_at, :processed_at)
|
||||
.pluck(:procedure_id, :en_construction_at, :processed_at)
|
||||
|
||||
# Group dossiers by month
|
||||
processed_dossiers_by_month = processed_dossiers
|
||||
|
@ -137,7 +137,7 @@ class StatsController < ApplicationController
|
|||
|
||||
processed_dossiers = dossiers
|
||||
.where(:processed_at => min_date..max_date)
|
||||
.pluck(:procedure_id, :created_at, :initiated_at, :processed_at)
|
||||
.pluck(:procedure_id, :created_at, :en_construction_at, :processed_at)
|
||||
|
||||
# Group dossiers by month
|
||||
processed_dossiers_by_month = processed_dossiers
|
||||
|
|
|
@ -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, :initiated],
|
||||
states: [:brouillon, :en_construction],
|
||||
api_carto: true
|
||||
}
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@ class Users::DescriptionController < UsersController
|
|||
|
||||
@headers = @champs.select { |c| c.type_champ == 'header_section' }
|
||||
|
||||
unless @dossier.can_be_initiated?
|
||||
unless @dossier.can_be_en_construction?
|
||||
flash[:alert] = t('errors.messages.procedure_archived')
|
||||
end
|
||||
|
||||
|
@ -27,7 +27,7 @@ class Users::DescriptionController < UsersController
|
|||
dossier = current_user_dossier
|
||||
procedure = dossier.procedure
|
||||
|
||||
return head :forbidden unless dossier.can_be_initiated?
|
||||
return head :forbidden unless dossier.can_be_en_construction?
|
||||
|
||||
ChampsService.save_champs(dossier.champs, params) if params[:champs]
|
||||
|
||||
|
@ -39,20 +39,20 @@ 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?
|
||||
dossier.initiated!
|
||||
if dossier.brouillon?
|
||||
NotificationMailer.send_notification(dossier, procedure.initiated_mail_template).deliver_now!
|
||||
dossier.en_construction!
|
||||
end
|
||||
flash.notice = 'Félicitations, votre demande a bien été enregistrée.'
|
||||
redirect_to url_for(controller: :recapitulatif, action: :show, dossier_id: dossier.id)
|
||||
|
@ -93,7 +93,7 @@ class Users::DescriptionController < UsersController
|
|||
|
||||
def self.route_authorization
|
||||
{
|
||||
states: [:draft, :initiated]
|
||||
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
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class Users::RecapitulatifController < UsersController
|
|||
|
||||
def self.route_authorization
|
||||
{
|
||||
states: [:initiated, :received, :without_continuation, :closed, :refused]
|
||||
states: [:en_construction, :en_instruction, :sans_suite, :accepte, :refuse]
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
module DossierHelper
|
||||
def button_or_label_class(dossier)
|
||||
if dossier.closed?
|
||||
if dossier.accepte?
|
||||
'accepted'
|
||||
elsif dossier.without_continuation?
|
||||
elsif dossier.sans_suite?
|
||||
'without-continuation'
|
||||
elsif dossier.refused?
|
||||
'refused'
|
||||
elsif dossier.refuse?
|
||||
'refuse'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ class AutoArchiveProcedureJob < ApplicationJob
|
|||
def perform(*args)
|
||||
Procedure.publiees.where("auto_archive_on <= ?", Date.today).each do |procedure|
|
||||
procedure.dossiers.state_en_construction.each do |dossier|
|
||||
dossier.received!
|
||||
dossier.en_instruction!
|
||||
end
|
||||
|
||||
procedure.archive
|
||||
|
|
|
@ -4,7 +4,7 @@ class AutoReceiveDossiersForProcedureJob < ApplicationJob
|
|||
def perform(procedure_id, state)
|
||||
procedure = Procedure.find_by(id: procedure_id)
|
||||
if procedure
|
||||
procedure.dossiers.state_nouveaux.update_all(state: state, received_at: Time.now)
|
||||
procedure.dossiers.state_nouveaux.update_all(state: state, en_instruction_at: Time.now)
|
||||
end
|
||||
end
|
||||
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,19 +1,19 @@
|
|||
class Dossier < ActiveRecord::Base
|
||||
enum state: {
|
||||
draft: 'draft',
|
||||
initiated: 'initiated',
|
||||
received: 'received',
|
||||
closed: 'closed',
|
||||
refused: 'refused',
|
||||
without_continuation: 'without_continuation'
|
||||
brouillon: 'brouillon',
|
||||
en_construction: 'en_construction',
|
||||
en_instruction: 'en_instruction',
|
||||
accepte: 'accepte',
|
||||
refuse: 'refuse',
|
||||
sans_suite: 'sans_suite'
|
||||
}
|
||||
|
||||
BROUILLON = %w(draft)
|
||||
NOUVEAUX = %w(initiated)
|
||||
EN_CONSTRUCTION = %w(initiated)
|
||||
EN_INSTRUCTION = %w(received)
|
||||
BROUILLON = %w(brouillon)
|
||||
NOUVEAUX = %w(en_construction)
|
||||
EN_CONSTRUCTION = %w(en_construction)
|
||||
EN_INSTRUCTION = %w(en_instruction)
|
||||
EN_CONSTRUCTION_OU_INSTRUCTION = EN_CONSTRUCTION + EN_INSTRUCTION
|
||||
TERMINE = %w(closed refused without_continuation)
|
||||
TERMINE = %w(accepte refuse sans_suite)
|
||||
|
||||
has_one :etablissement, dependent: :destroy
|
||||
has_one :entreprise, dependent: :destroy
|
||||
|
@ -58,7 +58,7 @@ class Dossier < ActiveRecord::Base
|
|||
scope :nouveaux, -> { not_archived.state_nouveaux }
|
||||
scope :en_instruction, -> { not_archived.state_en_instruction }
|
||||
scope :termine, -> { not_archived.state_termine }
|
||||
scope :downloadable_sorted, -> { state_not_brouillon.includes(:entreprise, :etablissement, :champs, :champs_private).order(initiated_at: 'asc') }
|
||||
scope :downloadable_sorted, -> { state_not_brouillon.includes(:entreprise, :etablissement, :champs, :champs_private).order(en_construction_at: 'asc') }
|
||||
scope :en_cours, -> { not_archived.state_en_construction_ou_instruction }
|
||||
scope :without_followers, -> { left_outer_joins(:follows).where(follows: { id: nil }) }
|
||||
scope :with_unread_notifications, -> { where(notifications: { already_read: false }) }
|
||||
|
@ -157,18 +157,18 @@ class Dossier < ActiveRecord::Base
|
|||
when 'user'
|
||||
case action
|
||||
when 'initiate'
|
||||
if draft?
|
||||
initiated!
|
||||
if brouillon?
|
||||
en_construction!
|
||||
end
|
||||
end
|
||||
when 'gestionnaire'
|
||||
case action
|
||||
when 'close'
|
||||
if received?
|
||||
if en_instruction?
|
||||
self.attestation = build_attestation
|
||||
save
|
||||
|
||||
closed!
|
||||
accepte!
|
||||
|
||||
if motivation
|
||||
self.motivation = motivation
|
||||
|
@ -176,8 +176,8 @@ class Dossier < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
when 'refuse'
|
||||
if received?
|
||||
refused!
|
||||
if en_instruction?
|
||||
refuse!
|
||||
|
||||
if motivation
|
||||
self.motivation = motivation
|
||||
|
@ -185,8 +185,8 @@ class Dossier < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
when 'without_continuation'
|
||||
if received?
|
||||
without_continuation!
|
||||
if en_instruction?
|
||||
sans_suite!
|
||||
|
||||
if motivation
|
||||
self.motivation = motivation
|
||||
|
@ -283,7 +283,7 @@ class Dossier < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def read_only?
|
||||
received? || closed? || refused? || without_continuation?
|
||||
en_instruction? || accepte? || refuse? || sans_suite?
|
||||
end
|
||||
|
||||
def owner? email
|
||||
|
@ -294,8 +294,8 @@ class Dossier < ActiveRecord::Base
|
|||
(invites_user.pluck :email).include? email
|
||||
end
|
||||
|
||||
def can_be_initiated?
|
||||
!(procedure.archivee? && draft?)
|
||||
def can_be_en_construction?
|
||||
!(procedure.archivee? && brouillon?)
|
||||
end
|
||||
|
||||
def text_summary
|
||||
|
@ -309,7 +309,7 @@ class Dossier < ActiveRecord::Base
|
|||
else
|
||||
parts = [
|
||||
"Dossier déposé le ",
|
||||
initiated_at.localtime.strftime("%d/%m/%Y"),
|
||||
en_construction_at.localtime.strftime("%d/%m/%Y"),
|
||||
" sur la procédure ",
|
||||
procedure.libelle,
|
||||
" gérée par l'organisme ",
|
||||
|
@ -364,11 +364,11 @@ class Dossier < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def statut
|
||||
if closed?
|
||||
if accepte?
|
||||
'accepté'
|
||||
elsif without_continuation?
|
||||
elsif sans_suite?
|
||||
'classé sans suite'
|
||||
elsif refused?
|
||||
elsif refuse?
|
||||
'refusé'
|
||||
end
|
||||
end
|
||||
|
@ -388,10 +388,10 @@ class Dossier < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def update_state_dates
|
||||
if initiated? && !self.initiated_at
|
||||
self.initiated_at = DateTime.now
|
||||
elsif received? && !self.received_at
|
||||
self.received_at = DateTime.now
|
||||
if en_construction? && !self.en_construction_at
|
||||
self.en_construction_at = DateTime.now
|
||||
elsif en_instruction? && !self.en_instruction_at
|
||||
self.en_instruction_at = DateTime.now
|
||||
elsif TERMINE.include?(state)
|
||||
self.processed_at = DateTime.now
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -14,13 +14,13 @@ class ProcedureOverview
|
|||
@old_dossiers_en_instruction = procedure
|
||||
.dossiers
|
||||
.state_en_instruction
|
||||
.where('received_at < ?', 1.week.ago)
|
||||
.where('en_instruction_at < ?', 1.week.ago)
|
||||
|
||||
@dossiers_en_construction_count = procedure.dossiers.state_en_construction.count
|
||||
@old_dossiers_en_construction = procedure
|
||||
.dossiers
|
||||
.state_en_construction
|
||||
.where('initiated_at < ?', 1.week.ago)
|
||||
.where('en_construction_at < ?', 1.week.ago)
|
||||
|
||||
@created_dossiers_count = procedure
|
||||
.dossiers
|
||||
|
|
|
@ -35,10 +35,35 @@ class DossierSerializer < ActiveModel::Serializer
|
|||
object.user.try(:email)
|
||||
end
|
||||
|
||||
def state
|
||||
case object.state
|
||||
when 'en_construction'
|
||||
'initiated'
|
||||
when 'en_instruction'
|
||||
'received'
|
||||
when 'accepte'
|
||||
'closed'
|
||||
when 'refuse'
|
||||
'refused'
|
||||
when 'sans_suite'
|
||||
'without_continuation'
|
||||
else
|
||||
object.state
|
||||
end
|
||||
end
|
||||
|
||||
def simplified_state
|
||||
object.decorate.display_state
|
||||
end
|
||||
|
||||
def initiated_at
|
||||
object.en_construction_at
|
||||
end
|
||||
|
||||
def received_at
|
||||
object.en_instruction_at
|
||||
end
|
||||
|
||||
def accompagnateurs
|
||||
object.followers_gestionnaires.pluck(:email)
|
||||
end
|
||||
|
|
|
@ -22,6 +22,31 @@ class DossierTableExportSerializer < ActiveModel::Serializer
|
|||
object.user.try(:email)
|
||||
end
|
||||
|
||||
def state
|
||||
case object.state
|
||||
when 'en_construction'
|
||||
'initiated'
|
||||
when 'en_instruction'
|
||||
'received'
|
||||
when 'accepte'
|
||||
'closed'
|
||||
when 'refuse'
|
||||
'refused'
|
||||
when 'sans_suite'
|
||||
'without_continuation'
|
||||
else
|
||||
object.state
|
||||
end
|
||||
end
|
||||
|
||||
def initiated_at
|
||||
object.en_construction_at
|
||||
end
|
||||
|
||||
def received_at
|
||||
object.en_instruction_at
|
||||
end
|
||||
|
||||
def individual_prenom
|
||||
object.individual.try(:prenom)
|
||||
end
|
||||
|
|
|
@ -2,4 +2,8 @@ class DossiersSerializer < ActiveModel::Serializer
|
|||
attributes :id,
|
||||
:updated_at,
|
||||
:initiated_at
|
||||
|
||||
def initiated_at
|
||||
object.en_construction_at
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
.col-xs-8.title-no-expanse
|
||||
.carret-right
|
||||
INFORMATIONS DU DEMANDEUR
|
||||
- if !@current_gestionnaire && ["draft", "initiated"].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
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
|
||||
- if current_gestionnaire && current_gestionnaire.assigned_on_procedure?(@facade.dossier.procedure_id)
|
||||
#action-block
|
||||
- if !@facade.dossier.read_only? || @facade.dossier.initiated?
|
||||
- if !@facade.dossier.read_only? || @facade.dossier.en_construction?
|
||||
= link_to 'Passer en instruction', backoffice_dossier_receive_path(@facade.dossier), method: :post, class: 'btn btn-danger btn-block', data: { confirm: "Confirmer vous le passage en instruction de ce dossier ?" }
|
||||
|
||||
- elsif @facade.dossier.received?
|
||||
- elsif @facade.dossier.en_instruction?
|
||||
= form_tag(backoffice_dossier_process_dossier_url(@facade.dossier.id), method: :post) do
|
||||
= text_area :dossier, :motivation, class: "motivation-text-area", placeholder: "Motivation (facultative)"
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
%span.label.instruction en instruction
|
||||
- elsif dossier.en_construction?
|
||||
%span.label.construction en construction
|
||||
- elsif dossier.closed?
|
||||
- elsif dossier.accepte?
|
||||
%span.label.accepted accepté
|
||||
- elsif dossier.refused?
|
||||
- elsif dossier.refuse?
|
||||
%span.label.refused refusé
|
||||
- elsif dossier.without_continuation?
|
||||
- elsif dossier.sans_suite?
|
||||
%span.label.without-continuation sans suite
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -36,10 +36,10 @@
|
|||
%div{ style: 'text-align: right;' }
|
||||
%h6 Tous les champs portant un * sont obligatoires.
|
||||
|
||||
- if !@dossier.can_be_initiated?
|
||||
- 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,12 +8,12 @@ fr:
|
|||
montant_aide_demande: "Le montant d'aide demandée"
|
||||
date_previsionnelle: "La date de début prévisionnelle"
|
||||
state:
|
||||
draft: "Brouillon"
|
||||
initiated: "En construction"
|
||||
received: "En instruction"
|
||||
closed: "Accepté"
|
||||
refused: "Refusé"
|
||||
without_continuation: "Sans suite"
|
||||
brouillon: "Brouillon"
|
||||
en_construction: "En construction"
|
||||
en_instruction: "En instruction"
|
||||
accepte: "Accepté"
|
||||
refuse: "Refusé"
|
||||
sans_suite: "Sans suite"
|
||||
|
||||
errors:
|
||||
models:
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class RenameDossierInitiatedByEnConstruction < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
rename_column :dossiers, :initiated_at, :en_construction_at
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class RenameDossierReceivedAtByEnInstructionAt < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
rename_column :dossiers, :received_at, :en_instruction_at
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20171205151128) do
|
||||
ActiveRecord::Schema.define(version: 20171214155554) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -194,8 +194,8 @@ ActiveRecord::Schema.define(version: 20171205151128) do
|
|||
t.text "json_latlngs"
|
||||
t.boolean "archived", default: false
|
||||
t.boolean "mandataire_social", default: false
|
||||
t.datetime "initiated_at"
|
||||
t.datetime "received_at"
|
||||
t.datetime "en_construction_at"
|
||||
t.datetime "en_instruction_at"
|
||||
t.datetime "processed_at"
|
||||
t.text "motivation"
|
||||
t.datetime "hidden_at"
|
||||
|
|
37
lib/tasks/2017_12_04_translate_dossier_state_to_french.rake
Normal file
37
lib/tasks/2017_12_04_translate_dossier_state_to_french.rake
Normal file
|
@ -0,0 +1,37 @@
|
|||
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
|
||||
|
||||
task en_instruction: :environment do
|
||||
Dossier.unscoped.where(state: 'received').update_all(state: 'en_instruction')
|
||||
end
|
||||
|
||||
task accepte: :environment do
|
||||
Dossier.unscoped.where(state: 'closed').update_all(state: 'accepte')
|
||||
end
|
||||
|
||||
task refuse: :environment do
|
||||
Dossier.unscoped.where(state: 'refused').update_all(state: 'refuse')
|
||||
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
|
||||
|
||||
task revert: :environment do
|
||||
Dossier.unscoped.where(state: 'brouillon').update_all(state: 'draft')
|
||||
Dossier.unscoped.where(state: 'en_construction').update_all(state: 'initiated')
|
||||
Dossier.unscoped.where(state: 'en_instruction').update_all(state: 'received')
|
||||
Dossier.unscoped.where(state: 'accepte').update_all(state: 'closed')
|
||||
Dossier.unscoped.where(state: 'refuse').update_all(state: 'refused')
|
||||
Dossier.unscoped.where(state: 'sans_suite').update_all(state: 'without_continuation')
|
||||
end
|
||||
end
|
|
@ -25,7 +25,7 @@ describe API::V1::DossiersController do
|
|||
context 'when procedure is found and belongs to admin' do
|
||||
let(:procedure_id) { procedure.id }
|
||||
let(:date_creation) { Time.utc(2008, 9, 1, 10, 5, 0) }
|
||||
let!(:dossier) { Timecop.freeze(date_creation) { create(:dossier, :with_entreprise, :initiated, procedure: procedure) } }
|
||||
let!(:dossier) { Timecop.freeze(date_creation) { create(:dossier, :with_entreprise, :en_construction, procedure: procedure) } }
|
||||
let(:body) { JSON.parse(retour.body, symbolize_names: true) }
|
||||
|
||||
it 'return REST code 200', :show_in_doc do
|
||||
|
@ -61,8 +61,8 @@ describe API::V1::DossiersController do
|
|||
context 'when there are multiple pages' do
|
||||
let(:retour) { get :index, params: {token: admin.api_token, procedure_id: procedure_id, page: 2} }
|
||||
|
||||
let!(:dossier1) { create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated') }
|
||||
let!(:dossier2) { create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated') }
|
||||
let!(:dossier1) { create(:dossier, :with_entreprise, procedure: procedure, state: 'en_construction') }
|
||||
let!(:dossier2) { create(:dossier, :with_entreprise, procedure: procedure, state: 'en_construction') }
|
||||
|
||||
before do
|
||||
allow(Dossier).to receive(:per_page).and_return(1)
|
||||
|
|
|
@ -5,7 +5,7 @@ describe Backoffice::AvisController, type: :controller do
|
|||
let(:claimant){ create(:gestionnaire) }
|
||||
let(:gestionnaire){ create(:gestionnaire) }
|
||||
let!(:dossier) do
|
||||
dossier = create(:dossier, state: 'received')
|
||||
dossier = create(:dossier, state: 'en_instruction')
|
||||
claimant.procedures << [dossier.procedure]
|
||||
dossier
|
||||
end
|
||||
|
@ -40,7 +40,7 @@ describe Backoffice::AvisController, type: :controller do
|
|||
|
||||
describe '#POST update' do
|
||||
let(:gestionnaire){ create(:gestionnaire) }
|
||||
let(:dossier){ create(:dossier, state: 'received') }
|
||||
let(:dossier){ create(:dossier, state: 'en_instruction') }
|
||||
let(:avis){ create(:avis, dossier: dossier, gestionnaire: gestionnaire )}
|
||||
|
||||
subject { post :update, params: { dossier_id: dossier.id, id: avis.id, avis: { answer: "Ok ce dossier est valide." } } }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Backoffice::CommentairesController, type: :controller do
|
||||
let(:dossier) { create(:dossier, :initiated) }
|
||||
let(:dossier) { create(:dossier, :en_construction) }
|
||||
let(:dossier_id) { dossier.id }
|
||||
let(:email_commentaire) { 'test@test.com' }
|
||||
let(:texte_commentaire) { 'Commentaire de test' }
|
||||
|
@ -89,10 +89,10 @@ describe Backoffice::CommentairesController, type: :controller do
|
|||
|
||||
describe 'change dossier state after post a comment' do
|
||||
context 'gestionnaire is connected' do
|
||||
context 'when dossier is at state initiated' do
|
||||
context 'when dossier is at state en_construction' do
|
||||
before do
|
||||
sign_in gestionnaire
|
||||
dossier.initiated!
|
||||
dossier.en_construction!
|
||||
|
||||
post :create, params: {dossier_id: dossier_id, texte_commentaire: texte_commentaire}
|
||||
dossier.reload
|
||||
|
|
|
@ -4,7 +4,7 @@ describe Backoffice::Dossiers::ProcedureController, type: :controller do
|
|||
let(:gestionnaire) { create :gestionnaire }
|
||||
let(:procedure) { create :procedure, :published }
|
||||
let(:archived) { false }
|
||||
let(:dossier) { create :dossier, procedure: procedure, archived: archived, state: 'initiated'}
|
||||
let(:dossier) { create :dossier, procedure: procedure, archived: archived, state: 'en_construction'}
|
||||
|
||||
before do
|
||||
create :assign_to, gestionnaire: gestionnaire, procedure: procedure
|
||||
|
|
|
@ -7,8 +7,8 @@ describe Backoffice::DossiersController, type: :controller do
|
|||
let(:procedure) { create :procedure, :published }
|
||||
let(:procedure2) { create :procedure, :published }
|
||||
|
||||
let(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: :initiated) }
|
||||
let(:dossier2) { create(:dossier, :with_entreprise, procedure: procedure2, state: :initiated) }
|
||||
let(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: :en_construction) }
|
||||
let(:dossier2) { create(:dossier, :with_entreprise, procedure: procedure2, state: :en_construction) }
|
||||
let(:dossier_archived) { create(:dossier, :with_entreprise, archived: true) }
|
||||
|
||||
let(:dossier_id) { dossier.id }
|
||||
|
@ -222,13 +222,13 @@ describe Backoffice::DossiersController, type: :controller do
|
|||
|
||||
describe 'POST #receive' do
|
||||
before do
|
||||
dossier.initiated!
|
||||
dossier.en_construction!
|
||||
sign_in gestionnaire
|
||||
post :receive, params: { dossier_id: dossier_id }
|
||||
dossier.reload
|
||||
end
|
||||
|
||||
it { expect(dossier.state).to eq('received') }
|
||||
it { expect(dossier.state).to eq('en_instruction') }
|
||||
it { is_expected.to redirect_to backoffice_dossier_path(dossier) }
|
||||
it { expect(gestionnaire.follow?(dossier)).to be true }
|
||||
end
|
||||
|
@ -236,17 +236,17 @@ describe Backoffice::DossiersController, type: :controller do
|
|||
describe 'POST #process_dossier' do
|
||||
context "with refuse" do
|
||||
before do
|
||||
dossier.received!
|
||||
dossier.en_instruction!
|
||||
sign_in gestionnaire
|
||||
end
|
||||
|
||||
subject { post :process_dossier, params: { process_action: "refuse", dossier_id: dossier_id} }
|
||||
|
||||
it 'change state to refused' do
|
||||
it 'change state to refuse' do
|
||||
subject
|
||||
|
||||
dossier.reload
|
||||
expect(dossier.state).to eq('refused')
|
||||
expect(dossier.state).to eq('refuse')
|
||||
end
|
||||
|
||||
it 'Notification email is sent' do
|
||||
|
@ -260,19 +260,19 @@ describe Backoffice::DossiersController, type: :controller do
|
|||
it { is_expected.to redirect_to backoffice_dossier_path(id: dossier.id) }
|
||||
end
|
||||
|
||||
context "with without_continuation" do
|
||||
context "with sans_suite" do
|
||||
before do
|
||||
dossier.received!
|
||||
dossier.en_instruction!
|
||||
sign_in gestionnaire
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
dossier.reload
|
||||
expect(dossier.state).to eq('without_continuation')
|
||||
expect(dossier.state).to eq('sans_suite')
|
||||
end
|
||||
|
||||
it 'Notification email is sent' do
|
||||
|
@ -290,7 +290,7 @@ describe Backoffice::DossiersController, type: :controller do
|
|||
let(:expected_attestation) { nil }
|
||||
|
||||
before do
|
||||
dossier.received!
|
||||
dossier.en_instruction!
|
||||
sign_in gestionnaire
|
||||
|
||||
expect(NotificationMailer).to receive(:send_notification)
|
||||
|
@ -302,11 +302,11 @@ describe Backoffice::DossiersController, type: :controller do
|
|||
|
||||
subject { post :process_dossier, params: { process_action: "close", dossier_id: dossier_id} }
|
||||
|
||||
it 'change state to closed' do
|
||||
it 'change state to accepte' do
|
||||
subject
|
||||
|
||||
dossier.reload
|
||||
expect(dossier.state).to eq('closed')
|
||||
expect(dossier.state).to eq('accepte')
|
||||
end
|
||||
|
||||
context 'when the dossier does not have any attestation' do
|
||||
|
@ -354,17 +354,17 @@ describe Backoffice::DossiersController, type: :controller do
|
|||
|
||||
describe 'POST #reopen' do
|
||||
before do
|
||||
dossier.received!
|
||||
dossier.en_instruction!
|
||||
sign_in gestionnaire
|
||||
end
|
||||
|
||||
subject { post :reopen, params: {dossier_id: dossier_id} }
|
||||
|
||||
it 'change state to initiated' do
|
||||
it 'change state to en_construction' do
|
||||
subject
|
||||
|
||||
dossier.reload
|
||||
expect(dossier.state).to eq('initiated')
|
||||
expect(dossier.state).to eq('en_construction')
|
||||
end
|
||||
|
||||
it { is_expected.to redirect_to backoffice_dossier_path(id: dossier_id) }
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
|||
|
||||
describe Backoffice::PrivateFormulairesController, type: :controller do
|
||||
let(:gestionnaire) { create :gestionnaire }
|
||||
let(:dossier) { create :dossier, state: :initiated }
|
||||
let(:dossier) { create :dossier, state: :en_construction }
|
||||
let(:dossier_champs_first) { 'plop' }
|
||||
|
||||
before do
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe InvitesController, type: :controller do
|
||||
let(:dossier) { create(:dossier, :initiated) }
|
||||
let(:dossier) { create(:dossier, :en_construction) }
|
||||
let(:email) { 'plop@octo.com' }
|
||||
|
||||
describe '#POST create' do
|
||||
|
|
|
@ -6,7 +6,7 @@ describe NewGestionnaire::AvisController, type: :controller do
|
|||
let(:claimant) { create(:gestionnaire) }
|
||||
let(:gestionnaire) { create(:gestionnaire) }
|
||||
let(:procedure) { create(:procedure, :published, gestionnaires: [gestionnaire]) }
|
||||
let(:dossier) { create(:dossier, :initiated, procedure: procedure) }
|
||||
let(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
|
||||
let!(:avis_without_answer) { Avis.create(dossier: dossier, claimant: claimant, gestionnaire: gestionnaire) }
|
||||
let!(:avis_with_answer) { Avis.create(dossier: dossier, claimant: claimant, gestionnaire: gestionnaire, answer: 'yop') }
|
||||
|
||||
|
|
|
@ -5,16 +5,16 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
|||
|
||||
let(:gestionnaire) { create(:gestionnaire) }
|
||||
let(:procedure) { create(:procedure, :published, gestionnaires: [gestionnaire]) }
|
||||
let(:dossier) { create(:dossier, :initiated, procedure: procedure) }
|
||||
let(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
|
||||
|
||||
before { sign_in(gestionnaire) }
|
||||
|
||||
describe '#attestation' do
|
||||
context 'when a dossier has an attestation' do
|
||||
let(:fake_pdf) { double(read: 'pdf content') }
|
||||
let!(:dossier) { create(:dossier, :initiated, attestation: Attestation.new, procedure: procedure) }
|
||||
let!(:dossier) { create(:dossier, :en_construction, attestation: Attestation.new, procedure: procedure) }
|
||||
let!(:procedure) { create(:procedure, :published, gestionnaires: [gestionnaire]) }
|
||||
let!(:dossier) { create(:dossier, :initiated, attestation: Attestation.new, procedure: procedure) }
|
||||
let!(:dossier) { create(:dossier, :en_construction, attestation: Attestation.new, procedure: procedure) }
|
||||
|
||||
it 'returns the attestation pdf' do
|
||||
allow_any_instance_of(Attestation).to receive(:pdf).and_return(fake_pdf)
|
||||
|
@ -79,30 +79,30 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
|||
|
||||
describe '#passer_en_instruction' do
|
||||
before do
|
||||
dossier.initiated!
|
||||
dossier.en_construction!
|
||||
sign_in gestionnaire
|
||||
post :passer_en_instruction, params: { procedure_id: procedure.id, dossier_id: dossier.id }
|
||||
dossier.reload
|
||||
end
|
||||
|
||||
it { expect(dossier.state).to eq('received') }
|
||||
it { expect(dossier.state).to eq('en_instruction') }
|
||||
it { is_expected.to redirect_to dossier_path(procedure, dossier) }
|
||||
it { expect(gestionnaire.follow?(dossier)).to be true }
|
||||
end
|
||||
|
||||
describe '#repasser_en_construction' do
|
||||
before do
|
||||
dossier.received!
|
||||
dossier.en_instruction!
|
||||
sign_in gestionnaire
|
||||
end
|
||||
|
||||
subject { post :repasser_en_construction, params: { procedure_id: procedure.id, dossier_id: dossier.id} }
|
||||
|
||||
it 'change state to initiated' do
|
||||
it 'change state to en_construction' do
|
||||
subject
|
||||
|
||||
dossier.reload
|
||||
expect(dossier.state).to eq('initiated')
|
||||
expect(dossier.state).to eq('en_construction')
|
||||
end
|
||||
|
||||
it { is_expected.to redirect_to dossier_path(procedure, dossier) }
|
||||
|
@ -111,17 +111,17 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
|||
describe '#terminer' do
|
||||
context "with refuser" do
|
||||
before do
|
||||
dossier.received!
|
||||
dossier.en_instruction!
|
||||
sign_in gestionnaire
|
||||
end
|
||||
|
||||
subject { post :terminer, params: { process_action: "refuser", procedure_id: procedure.id, dossier_id: dossier.id} }
|
||||
|
||||
it 'change state to refused' do
|
||||
it 'change state to refuse' do
|
||||
subject
|
||||
|
||||
dossier.reload
|
||||
expect(dossier.state).to eq('refused')
|
||||
expect(dossier.state).to eq('refuse')
|
||||
end
|
||||
|
||||
it 'Notification email is sent' do
|
||||
|
@ -137,17 +137,17 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
|||
|
||||
context "with classer_sans_suite" do
|
||||
before do
|
||||
dossier.received!
|
||||
dossier.en_instruction!
|
||||
sign_in gestionnaire
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
dossier.reload
|
||||
expect(dossier.state).to eq('without_continuation')
|
||||
expect(dossier.state).to eq('sans_suite')
|
||||
end
|
||||
|
||||
it 'Notification email is sent' do
|
||||
|
@ -165,7 +165,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
|||
let(:expected_attestation) { nil }
|
||||
|
||||
before do
|
||||
dossier.received!
|
||||
dossier.en_instruction!
|
||||
sign_in gestionnaire
|
||||
|
||||
expect(NotificationMailer).to receive(:send_notification)
|
||||
|
@ -177,11 +177,11 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
|||
|
||||
subject { post :terminer, params: { process_action: "accepter", procedure_id: procedure.id, dossier_id: dossier.id} }
|
||||
|
||||
it 'change state to closed' do
|
||||
it 'change state to accepte' do
|
||||
subject
|
||||
|
||||
dossier.reload
|
||||
expect(dossier.state).to eq('closed')
|
||||
expect(dossier.state).to eq('accepte')
|
||||
end
|
||||
|
||||
context 'when the dossier does not have any attestation' do
|
||||
|
@ -344,7 +344,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
|||
end
|
||||
|
||||
let(:dossier) do
|
||||
create(:dossier, :initiated, procedure: procedure, champs_private: [champ_multiple_drop_down_list, champ_datetime])
|
||||
create(:dossier, :en_construction, procedure: procedure, champs_private: [champ_multiple_drop_down_list, champ_datetime])
|
||||
end
|
||||
|
||||
before do
|
||||
|
|
|
@ -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) }
|
||||
|
@ -134,17 +134,17 @@ describe NewGestionnaire::ProceduresController, type: :controller do
|
|||
|
||||
context "with not draft state on multiple procedures" do
|
||||
let(:procedure2) { create(:procedure, :published) }
|
||||
let(:state) { "initiated" }
|
||||
let(:state) { "en_construction" }
|
||||
|
||||
before do
|
||||
create(:dossier, procedure: procedure, state: "initiated")
|
||||
create(:dossier, procedure: procedure, state: "received")
|
||||
create(:dossier, procedure: procedure, state: "without_continuation", archived: true)
|
||||
create(:dossier, procedure: procedure, state: "en_construction")
|
||||
create(:dossier, procedure: procedure, state: "en_instruction")
|
||||
create(:dossier, procedure: procedure, state: "sans_suite", archived: true)
|
||||
|
||||
gestionnaire.procedures << procedure2
|
||||
create(:dossier, :followed, procedure: procedure2, state: "initiated")
|
||||
create(:dossier, procedure: procedure2, state: "closed")
|
||||
gestionnaire.followed_dossiers << create(:dossier, procedure: procedure2, state: "received")
|
||||
create(:dossier, :followed, procedure: procedure2, state: "en_construction")
|
||||
create(:dossier, procedure: procedure2, state: "accepte")
|
||||
gestionnaire.followed_dossiers << create(:dossier, procedure: procedure2, state: "en_instruction")
|
||||
|
||||
subject
|
||||
end
|
||||
|
@ -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: 'brouillon') }
|
||||
|
||||
before do
|
||||
get :show, params: { procedure_id: procedure.id }
|
||||
|
@ -196,7 +196,7 @@ describe NewGestionnaire::ProceduresController, type: :controller do
|
|||
end
|
||||
|
||||
context 'with a new dossier without follower' do
|
||||
let!(:new_unfollow_dossier) { create(:dossier, procedure: procedure, state: 'received') }
|
||||
let!(:new_unfollow_dossier) { create(:dossier, procedure: procedure, state: 'en_instruction') }
|
||||
|
||||
before do
|
||||
get :show, params: { procedure_id: procedure.id }
|
||||
|
@ -210,7 +210,7 @@ describe NewGestionnaire::ProceduresController, type: :controller do
|
|||
end
|
||||
|
||||
context 'with a new dossier with a follower' do
|
||||
let!(:new_followed_dossier) { create(:dossier, procedure: procedure, state: 'received') }
|
||||
let!(:new_followed_dossier) { create(:dossier, procedure: procedure, state: 'en_instruction') }
|
||||
|
||||
before do
|
||||
gestionnaire.followed_dossiers << new_followed_dossier
|
||||
|
@ -225,7 +225,7 @@ describe NewGestionnaire::ProceduresController, type: :controller do
|
|||
end
|
||||
|
||||
context 'with a termine dossier with a follower' do
|
||||
let!(:termine_dossier) { create(:dossier, procedure: procedure, state: 'closed') }
|
||||
let!(:termine_dossier) { create(:dossier, procedure: procedure, state: 'accepte') }
|
||||
|
||||
before do
|
||||
get :show, params: { procedure_id: procedure.id }
|
||||
|
@ -239,7 +239,7 @@ describe NewGestionnaire::ProceduresController, type: :controller do
|
|||
end
|
||||
|
||||
context 'with an archived dossier' do
|
||||
let!(:archived_dossier) { create(:dossier, procedure: procedure, state: 'received', archived: true) }
|
||||
let!(:archived_dossier) { create(:dossier, procedure: procedure, state: 'en_instruction', archived: true) }
|
||||
|
||||
before do
|
||||
get :show, params: { procedure_id: procedure.id }
|
||||
|
@ -253,10 +253,10 @@ describe NewGestionnaire::ProceduresController, type: :controller do
|
|||
end
|
||||
|
||||
describe 'statut' do
|
||||
let!(:a_suivre__dossier) { Timecop.freeze(1.day.ago){ create(:dossier, procedure: procedure, state: 'received') } }
|
||||
let!(:new_followed_dossier) { Timecop.freeze(2.day.ago){ create(:dossier, procedure: procedure, state: 'received') } }
|
||||
let!(:termine_dossier) { Timecop.freeze(3.day.ago){ create(:dossier, procedure: procedure, state: 'closed') } }
|
||||
let!(:archived_dossier) { Timecop.freeze(4.day.ago){ create(:dossier, procedure: procedure, state: 'received', archived: true) } }
|
||||
let!(:a_suivre__dossier) { Timecop.freeze(1.day.ago){ create(:dossier, procedure: procedure, state: 'en_instruction') } }
|
||||
let!(:new_followed_dossier) { Timecop.freeze(2.day.ago){ create(:dossier, procedure: procedure, state: 'en_instruction') } }
|
||||
let!(:termine_dossier) { Timecop.freeze(3.day.ago){ create(:dossier, procedure: procedure, state: 'accepte') } }
|
||||
let!(:archived_dossier) { Timecop.freeze(4.day.ago){ create(:dossier, procedure: procedure, state: 'en_instruction', archived: true) } }
|
||||
|
||||
before do
|
||||
gestionnaire.followed_dossiers << new_followed_dossier
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe NewGestionnaire::RechercheController, type: :controller do
|
||||
let(:dossier) { create(:dossier, :initiated) }
|
||||
let(:dossier2) { create(:dossier, :initiated, procedure: dossier.procedure) }
|
||||
let(:dossier) { create(:dossier, :en_construction) }
|
||||
let(:dossier2) { create(:dossier, :en_construction, procedure: dossier.procedure) }
|
||||
let(:gestionnaire) { create(:gestionnaire) }
|
||||
|
||||
before { gestionnaire.procedures << dossier2.procedure }
|
||||
|
@ -26,7 +26,7 @@ describe NewGestionnaire::RechercheController, type: :controller do
|
|||
end
|
||||
|
||||
context 'when gestionnaire do not own the dossier' do
|
||||
let(:dossier3) { create(:dossier, :initiated) }
|
||||
let(:dossier3) { create(:dossier, :en_construction) }
|
||||
let(:query) { dossier3.id }
|
||||
|
||||
it { is_expected.to have_http_status(200) }
|
||||
|
|
|
@ -141,24 +141,24 @@ describe StatsController, type: :controller do
|
|||
procedure_1 = FactoryGirl.create(:procedure)
|
||||
procedure_2 = FactoryGirl.create(:procedure)
|
||||
dossier_p1_a = FactoryGirl.create(:dossier,
|
||||
:procedure => procedure_1,
|
||||
:initiated_at => 2.months.ago.beginning_of_month,
|
||||
:processed_at => 2.months.ago.beginning_of_month + 3.days)
|
||||
:procedure => procedure_1,
|
||||
:en_construction_at => 2.months.ago.beginning_of_month,
|
||||
:processed_at => 2.months.ago.beginning_of_month + 3.days)
|
||||
dossier_p1_b = FactoryGirl.create(:dossier,
|
||||
:procedure => procedure_1,
|
||||
:initiated_at => 2.months.ago.beginning_of_month,
|
||||
:processed_at => 2.months.ago.beginning_of_month + 1.days)
|
||||
:procedure => procedure_1,
|
||||
:en_construction_at => 2.months.ago.beginning_of_month,
|
||||
:processed_at => 2.months.ago.beginning_of_month + 1.days)
|
||||
dossier_p1_c = FactoryGirl.create(:dossier,
|
||||
:procedure => procedure_1,
|
||||
:initiated_at => 1.months.ago.beginning_of_month,
|
||||
:processed_at => 1.months.ago.beginning_of_month + 5.days)
|
||||
:procedure => procedure_1,
|
||||
:en_construction_at => 1.months.ago.beginning_of_month,
|
||||
:processed_at => 1.months.ago.beginning_of_month + 5.days)
|
||||
dossier_p2_a = FactoryGirl.create(:dossier,
|
||||
:procedure => procedure_2,
|
||||
:initiated_at => 2.month.ago.beginning_of_month,
|
||||
:processed_at => 2.month.ago.beginning_of_month + 4.days)
|
||||
:procedure => procedure_2,
|
||||
:en_construction_at => 2.month.ago.beginning_of_month,
|
||||
:processed_at => 2.month.ago.beginning_of_month + 4.days)
|
||||
|
||||
# Write directly in the DB to avoid the before_validation hook
|
||||
Dossier.update_all(state: "closed")
|
||||
Dossier.update_all(state: "accepte")
|
||||
|
||||
@expected_hash = {
|
||||
"#{2.months.ago.beginning_of_month}" => 3.0,
|
||||
|
@ -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) }
|
||||
|
||||
|
@ -191,26 +191,26 @@ describe StatsController, type: :controller do
|
|||
dossier_p1_a = FactoryGirl.create(:dossier,
|
||||
:procedure => procedure_1,
|
||||
:created_at => 2.months.ago.beginning_of_month,
|
||||
:initiated_at => 2.months.ago.beginning_of_month + 30.minutes,
|
||||
:en_construction_at => 2.months.ago.beginning_of_month + 30.minutes,
|
||||
:processed_at => 2.months.ago.beginning_of_month + 1.day)
|
||||
dossier_p1_b = FactoryGirl.create(:dossier,
|
||||
:procedure => procedure_1,
|
||||
:created_at => 2.months.ago.beginning_of_month,
|
||||
:initiated_at => 2.months.ago.beginning_of_month + 10.minutes,
|
||||
:en_construction_at => 2.months.ago.beginning_of_month + 10.minutes,
|
||||
:processed_at => 2.months.ago.beginning_of_month + 1.day)
|
||||
dossier_p1_c = FactoryGirl.create(:dossier,
|
||||
:procedure => procedure_1,
|
||||
:created_at => 1.months.ago.beginning_of_month,
|
||||
:initiated_at => 1.months.ago.beginning_of_month + 50.minutes,
|
||||
:en_construction_at => 1.months.ago.beginning_of_month + 50.minutes,
|
||||
:processed_at => 1.months.ago.beginning_of_month + 1.day)
|
||||
dossier_p2_a = FactoryGirl.create(:dossier,
|
||||
:procedure => procedure_2,
|
||||
:created_at => 2.month.ago.beginning_of_month,
|
||||
:initiated_at => 2.month.ago.beginning_of_month + 80.minutes,
|
||||
:en_construction_at => 2.month.ago.beginning_of_month + 80.minutes,
|
||||
:processed_at => 2.month.ago.beginning_of_month + 1.day)
|
||||
|
||||
# Write directly in the DB to avoid the before_validation hook
|
||||
Dossier.update_all(state: "closed")
|
||||
Dossier.update_all(state: "accepte")
|
||||
|
||||
@expected_hash = {
|
||||
"#{2.months.ago.beginning_of_month}" => 30.0,
|
||||
|
@ -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) }
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ shared_examples 'carte_controller_spec' do
|
|||
context 'when dossier’s procedure have api carto actived' do
|
||||
context 'when dossier does not have a valid state' do
|
||||
before do
|
||||
dossier.state = 'received'
|
||||
dossier.state = 'en_instruction'
|
||||
dossier.save
|
||||
|
||||
get :show, params: {dossier_id: dossier.id}
|
||||
|
@ -67,7 +67,7 @@ shared_examples 'carte_controller_spec' do
|
|||
end
|
||||
|
||||
context 'En train de modifier la localisation' do
|
||||
let(:dossier) { create(:dossier, state: 'initiated') }
|
||||
let(:dossier) { create(:dossier, state: 'en_construction') }
|
||||
before do
|
||||
post :save, params: {dossier_id: dossier.id, json_latlngs: ''}
|
||||
end
|
||||
|
|
|
@ -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')) }
|
||||
|
@ -52,7 +52,7 @@ shared_examples 'description_controller_spec' do
|
|||
describe 'before_action authorized_routes?' do
|
||||
context 'when dossier does not have a valid state' do
|
||||
before do
|
||||
dossier.state = 'received'
|
||||
dossier.state = 'en_instruction'
|
||||
dossier.save
|
||||
|
||||
get :show, params: {dossier_id: dossier.id}
|
||||
|
@ -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
|
||||
|
@ -125,10 +125,10 @@ shared_examples 'description_controller_spec' do
|
|||
end
|
||||
|
||||
it 'etat du dossier est soumis' do
|
||||
expect(dossier.state).to eq('initiated')
|
||||
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,14 +136,14 @@ 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
|
||||
|
||||
context 'En train de manipuler un dossier non brouillon' do
|
||||
before do
|
||||
dossier.initiated!
|
||||
dossier.en_construction!
|
||||
post :update, params: {dossier_id: dossier_id}
|
||||
dossier.reload
|
||||
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
|
||||
|
|
|
@ -6,7 +6,7 @@ describe Users::DescriptionController, type: :controller, vcr: {cassette_name: '
|
|||
let(:owner_user) { create(:user) }
|
||||
let(:invite_by_user) { create :user, email: 'invite@plop.com' }
|
||||
let(:archived_at) { nil }
|
||||
let(:state) { 'initiated' }
|
||||
let(:state) { 'en_construction' }
|
||||
|
||||
let(:procedure) { create(:procedure, :with_two_type_de_piece_justificative, :with_type_de_champ, :with_datetime, cerfa_flag: true, published_at: Time.now, archived_at: archived_at) }
|
||||
let(:dossier) { create(:dossier, procedure: procedure, user: owner_user, state: state) }
|
||||
|
|
|
@ -39,7 +39,7 @@ describe Users::DossiersController, type: :controller do
|
|||
describe 'before_action authorized_routes?' do
|
||||
context 'when dossier does not have a valid state' do
|
||||
before do
|
||||
dossier.state = 'received'
|
||||
dossier.state = 'en_instruction'
|
||||
dossier.save
|
||||
|
||||
get :show, params: {id: dossier.id}
|
||||
|
@ -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: "initiated", 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
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Users::RecapitulatifController, type: :controller do
|
||||
let(:dossier) { create(:dossier, state: 'initiated') }
|
||||
let(:dossier) { create(:dossier, state: 'en_construction') }
|
||||
let(:bad_dossier_id) { Dossier.count + 100000 }
|
||||
|
||||
before do
|
||||
|
@ -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}
|
||||
|
@ -41,12 +41,12 @@ describe Users::RecapitulatifController, type: :controller do
|
|||
post :initiate, params: {dossier_id: dossier.id}
|
||||
end
|
||||
|
||||
it 'dossier change his state for closed' do
|
||||
it 'dossier change his state for accepte' do
|
||||
dossier.reload
|
||||
expect(dossier.state).to eq('initiated')
|
||||
expect(dossier.state).to eq('en_construction')
|
||||
end
|
||||
|
||||
it 'a message informe user what his dossier is initiated' do
|
||||
it 'a message informe user what his dossier is en_construction' do
|
||||
expect(flash[:notice]).to include('Dossier soumis avec succès.')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,33 +22,33 @@ 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
|
||||
|
||||
it 'initiated is initiate' do
|
||||
dossier.initiated!
|
||||
it 'en_construction is En construction' do
|
||||
dossier.en_construction!
|
||||
expect(subject).to eq('En construction')
|
||||
end
|
||||
|
||||
it 'closed is traité' do
|
||||
dossier.closed!
|
||||
it 'accepte is traité' do
|
||||
dossier.accepte!
|
||||
expect(subject).to eq('Accepté')
|
||||
end
|
||||
|
||||
it 'received is reçu' do
|
||||
dossier.received!
|
||||
it 'en_instruction is reçu' do
|
||||
dossier.en_instruction!
|
||||
expect(subject).to eq('En instruction')
|
||||
end
|
||||
|
||||
it 'without_continuation is traité' do
|
||||
dossier.without_continuation!
|
||||
it 'sans_suite is traité' do
|
||||
dossier.sans_suite!
|
||||
expect(subject).to eq('Sans suite')
|
||||
end
|
||||
|
||||
it 'refused is traité' do
|
||||
dossier.refused!
|
||||
it 'refuse is traité' do
|
||||
dossier.refuse!
|
||||
expect(subject).to eq('Refusé')
|
||||
end
|
||||
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
|
||||
|
||||
|
@ -74,7 +74,7 @@ describe DossierDecorator do
|
|||
|
||||
context "when the dossier is not in brouillon state" do
|
||||
before do
|
||||
dossier.state = 'initiated'
|
||||
dossier.state = 'en_construction'
|
||||
dossier.save
|
||||
end
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@ require 'spec_helper'
|
|||
describe AdminProceduresShowFacades do
|
||||
let!(:procedure) { create(:procedure) }
|
||||
|
||||
let!(:dossier_0) { create(:dossier, procedure: procedure, state: 'draft') }
|
||||
let!(:dossier_1) { create(:dossier, procedure: procedure, state: 'initiated') }
|
||||
let!(:dossier_2) { create(:dossier, procedure: procedure, state: 'initiated') }
|
||||
let!(:dossier_6) { create(:dossier, procedure: procedure, archived: true, state: 'initiated') }
|
||||
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') }
|
||||
|
||||
subject { AdminProceduresShowFacades.new procedure }
|
||||
|
||||
|
@ -33,7 +33,7 @@ describe AdminProceduresShowFacades do
|
|||
|
||||
it { expect(subject.size).to eq(1) }
|
||||
|
||||
it { expect(subject.first.state).to eq('initiated') }
|
||||
it { expect(subject.first.state).to eq('en_construction') }
|
||||
it { expect(subject.first.total).to eq(1) }
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
FactoryGirl.define do
|
||||
factory :dossier do
|
||||
state 'draft'
|
||||
state 'brouillon'
|
||||
association :user, factory: [:user]
|
||||
|
||||
before(:create) do |dossier, _evaluator|
|
||||
|
@ -72,18 +72,18 @@ FactoryGirl.define do
|
|||
end
|
||||
end
|
||||
|
||||
trait :initiated do
|
||||
trait :en_construction do
|
||||
after(:create) do |dossier, _evaluator|
|
||||
dossier.state = 'initiated'
|
||||
dossier.initiated_at = dossier.created_at + 1.minute
|
||||
dossier.state = 'en_construction'
|
||||
dossier.en_construction_at = dossier.created_at + 1.minute
|
||||
dossier.save!
|
||||
end
|
||||
end
|
||||
|
||||
trait :received do
|
||||
trait :en_instruction do
|
||||
after(:create) do |dossier, _evaluator|
|
||||
dossier.state = 'received'
|
||||
dossier.initiated_at = dossier.created_at + 1.minute
|
||||
dossier.state = 'en_instruction'
|
||||
dossier.en_construction_at = dossier.created_at + 1.minute
|
||||
dossier.created_at = dossier.created_at + 2.minute
|
||||
dossier.save!
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ FactoryGirl.define do
|
|||
type 'MailRefused'
|
||||
end
|
||||
|
||||
trait :dossier_received do
|
||||
trait :dossier_en_instruction do
|
||||
object "[TPS] Accusé de réception pour votre dossier nº --numero_dossier--"
|
||||
body "Votre administration vous confirme la bonne réception de votre dossier nº --numero_dossier--"
|
||||
type 'MailReceived'
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
|||
|
||||
feature 'add commentaire on backoffice' do
|
||||
let(:procedure) { create(:procedure, :published) }
|
||||
let(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated') }
|
||||
let(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'en_construction') }
|
||||
let(:dossier_id) { dossier.id }
|
||||
let!(:commentaire) { create(:commentaire, dossier: dossier, email: 'toto@toto.com') }
|
||||
let(:email_commentaire) { 'test@test.com' }
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
|||
feature 'backoffice: flux de commentaires' do
|
||||
let(:procedure) { create(:procedure, :published) }
|
||||
let(:gestionnaire) { create(:gestionnaire) }
|
||||
let(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated') }
|
||||
let(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'en_construction') }
|
||||
let(:dossier_id) { dossier.id }
|
||||
|
||||
let(:champ1) { create(:champ, dossier: dossier, type_de_champ: create(:type_de_champ_public, libelle: "subtitle1")) }
|
||||
|
|
|
@ -10,10 +10,10 @@ feature 'As an Accompagnateur I can navigate and use each functionnality around
|
|||
create :assign_to, gestionnaire: gestionnaire, procedure: procedure_1
|
||||
create :assign_to, gestionnaire: gestionnaire, procedure: procedure_2
|
||||
30.times do
|
||||
Dossier.create(procedure_id: procedure_1.id.to_s, user: user, state: 'initiated')
|
||||
Dossier.create(procedure_id: procedure_1.id.to_s, user: user, state: 'en_construction')
|
||||
end
|
||||
22.times do
|
||||
Dossier.create(procedure_id: procedure_2.id.to_s, user: user, state: 'received')
|
||||
Dossier.create(procedure_id: procedure_2.id.to_s, user: user, state: 'en_instruction')
|
||||
end
|
||||
login_as gestionnaire, scope: :gestionnaire
|
||||
visit backoffice_path
|
||||
|
|
|
@ -6,7 +6,7 @@ feature 'usage of pref list dossier lateral panel', js: true do
|
|||
let(:procedure) { create(:procedure, :published, administrateur: administrateur) }
|
||||
|
||||
before do
|
||||
create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated')
|
||||
create(:dossier, :with_entreprise, procedure: procedure, state: 'en_construction')
|
||||
create :assign_to, procedure: procedure, gestionnaire: gestionnaire
|
||||
|
||||
login_as gestionnaire, scope: :gestionnaire
|
||||
|
|
|
@ -6,7 +6,7 @@ feature 'usage of pref list dossier lateral panel by procedure', js: true do
|
|||
let(:procedure) { create(:procedure, :published, :with_type_de_champ, administrateur: administrateur) }
|
||||
|
||||
before do
|
||||
create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated')
|
||||
create(:dossier, :with_entreprise, procedure: procedure, state: 'en_construction')
|
||||
create :assign_to, procedure: procedure, gestionnaire: gestionnaire
|
||||
|
||||
login_as gestionnaire, scope: :gestionnaire
|
||||
|
|
|
@ -6,8 +6,8 @@ feature 'on backoffice page', js: true do
|
|||
let(:procedure) { create(:procedure, :published, administrateur: administrateur) }
|
||||
let(:procedure_individual) { create :procedure, :published, libelle: 'procedure individual', administrateur: administrateur, for_individual: true }
|
||||
|
||||
let!(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated') }
|
||||
let!(:dossier_individual) { create :dossier, procedure: procedure_individual, state: 'initiated' }
|
||||
let!(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'en_construction') }
|
||||
let!(:dossier_individual) { create :dossier, procedure: procedure_individual, state: 'en_construction' }
|
||||
|
||||
before do
|
||||
create :assign_to, gestionnaire: gestionnaire, procedure: procedure
|
||||
|
@ -34,7 +34,7 @@ feature 'on backoffice page', js: true do
|
|||
end
|
||||
|
||||
context "and goes to the page of a dossier he hasn't access to" do
|
||||
let!(:unauthorized_dossier) { create(:dossier, :with_entreprise, state: 'initiated') }
|
||||
let!(:unauthorized_dossier) { create(:dossier, :with_entreprise, state: 'en_construction') }
|
||||
|
||||
before do
|
||||
visit backoffice_dossier_path(unauthorized_dossier)
|
||||
|
|
|
@ -39,8 +39,8 @@ feature 'search file on gestionnaire backoffice' do
|
|||
end
|
||||
|
||||
context 'when terms input does return result' do
|
||||
let!(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated') }
|
||||
let!(:dossier_2) { create(:dossier, procedure: procedure, state: 'initiated') }
|
||||
let!(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'en_construction') }
|
||||
let!(:dossier_2) { create(:dossier, procedure: procedure, state: 'en_construction') }
|
||||
|
||||
let(:terms) { dossier.entreprise.raison_sociale }
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ feature 'The gestionnaire part' do
|
|||
let!(:gestionnaire) { create(:gestionnaire, password: password) }
|
||||
|
||||
let!(:procedure) { create(:procedure, :published, gestionnaires: [gestionnaire]) }
|
||||
let!(:dossier) { create(:dossier, state: :initiated, procedure: procedure) }
|
||||
let!(:dossier) { create(:dossier, state: :en_construction, procedure: procedure) }
|
||||
|
||||
scenario 'A gestionnaire can accept a dossier' do
|
||||
log_in(gestionnaire.email, password)
|
||||
|
@ -21,7 +21,7 @@ feature 'The gestionnaire part' do
|
|||
|
||||
click_on 'Passer en instruction'
|
||||
dossier.reload
|
||||
expect(dossier.state).to eq('received')
|
||||
expect(dossier.state).to eq('en_instruction')
|
||||
|
||||
within('.accept.motivation') do
|
||||
fill_in('dossier_motivation', with: 'a good reason')
|
||||
|
@ -29,7 +29,7 @@ feature 'The gestionnaire part' do
|
|||
end
|
||||
|
||||
dossier.reload
|
||||
expect(dossier.state).to eq('closed')
|
||||
expect(dossier.state).to eq('accepte')
|
||||
expect(dossier.motivation).to eq('a good reason')
|
||||
end
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ feature "procedure filters" do
|
|||
let(:procedure) { create(:procedure, :published, :with_type_de_champ) }
|
||||
let(:gestionnaire) { create(:gestionnaire, procedures: [procedure]) }
|
||||
let!(:type_de_champ) { procedure.types_de_champ.first }
|
||||
let!(:new_unfollow_dossier) { create(:dossier, procedure: procedure, state: "received") }
|
||||
let!(:new_unfollow_dossier) { create(:dossier, procedure: procedure, state: "en_instruction") }
|
||||
let!(:champ) { Champ.find_by(type_de_champ_id: type_de_champ.id, dossier_id: new_unfollow_dossier.id) }
|
||||
let!(:new_unfollow_dossier_2) { create(:dossier, procedure: procedure, state: "received") }
|
||||
let!(:new_unfollow_dossier_2) { create(:dossier, procedure: procedure, state: "en_instruction") }
|
||||
|
||||
before do
|
||||
champ.update_attributes(value: "Mon champ rempli")
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
|||
feature 'As a User I want to edit a dossier I own' do
|
||||
let(:user) { create(:user) }
|
||||
let(:procedure_for_individual) { create(:procedure, :published, :for_individual, :with_type_de_champ, :with_two_type_de_piece_justificative, :with_dossier_link) }
|
||||
let!(:dossier) { create(:dossier, :with_entreprise, :for_individual, :with_dossier_link, procedure: procedure_for_individual, user: user, autorisation_donnees: true, state: 'initiated') }
|
||||
let!(:dossier) { create(:dossier, :with_entreprise, :for_individual, :with_dossier_link, procedure: procedure_for_individual, user: user, autorisation_donnees: true, state: 'en_construction') }
|
||||
|
||||
before "Create dossier and visit root path" do
|
||||
login_as user, scope: :user
|
||||
|
|
|
@ -14,7 +14,7 @@ feature 'As a User I want to sort and paginate dossiers', js: true do
|
|||
page.find_by_id('etape_suivante').trigger('click')
|
||||
page.find_by_id('suivant').trigger('click')
|
||||
50.times do
|
||||
Dossier.create(procedure_id: procedure_for_individual.id, user_id: user.id, state: "initiated")
|
||||
Dossier.create(procedure_id: procedure_for_individual.id, user_id: user.id, state: "en_construction")
|
||||
end
|
||||
visit root_path
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
|||
|
||||
feature 'users: flux de commentaires' do
|
||||
let(:user) { create(:user) }
|
||||
let(:dossier) { create(:dossier, :with_entreprise, user: user, state: "initiated") }
|
||||
let(:dossier) { create(:dossier, :with_entreprise, user: user, state: "en_construction") }
|
||||
let(:dossier_id) { dossier.id }
|
||||
|
||||
let(:champ1) { dossier.champs.first }
|
||||
|
|
|
@ -2,10 +2,10 @@ require 'spec_helper'
|
|||
|
||||
describe 'user access to the list of his dossier' do
|
||||
let(:user) { create(:user) }
|
||||
let!(:last_updated_dossier) { create(:dossier, :with_entreprise, user: user, state: 'initiated')}
|
||||
let!(:dossier1) { create(:dossier, :with_entreprise, user: user, state: 'initiated') }
|
||||
let!(:last_updated_dossier) { create(:dossier, :with_entreprise, user: user, state: 'en_construction')}
|
||||
let!(:dossier1) { create(:dossier, :with_entreprise, user: user, state: 'en_construction') }
|
||||
let!(:dossier2) { create(:dossier, :with_entreprise) }
|
||||
let!(:dossier_archived) { create(:dossier, :with_entreprise, user: user, state: 'initiated') }
|
||||
let!(:dossier_archived) { create(:dossier, :with_entreprise, user: user, state: 'en_construction') }
|
||||
|
||||
before do
|
||||
last_updated_dossier.update_column(:updated_at, "19/07/2052 15:35".to_time)
|
||||
|
|
|
@ -3,14 +3,14 @@ require 'spec_helper'
|
|||
feature 'on click on tabs button' do
|
||||
let(:user) { create :user }
|
||||
|
||||
let(:dossier_invite) { create(:dossier, :with_entreprise, user: create(:user), state: 'initiated') }
|
||||
let(:dossier_invite) { create(:dossier, :with_entreprise, user: create(:user), state: 'en_construction') }
|
||||
|
||||
before do
|
||||
create(:dossier, :with_entreprise, user: user, state: 'initiated')
|
||||
create(:dossier, :with_entreprise, user: user, state: 'received')
|
||||
create(:dossier, :with_entreprise, user: user, state: 'closed')
|
||||
create(:dossier, :with_entreprise, user: user, state: 'refused')
|
||||
create(:dossier, :with_entreprise, user: user, state: 'without_continuation')
|
||||
create(:dossier, :with_entreprise, user: user, state: 'en_construction')
|
||||
create(:dossier, :with_entreprise, user: user, state: 'en_instruction')
|
||||
create(:dossier, :with_entreprise, user: user, state: 'accepte')
|
||||
create(:dossier, :with_entreprise, user: user, state: 'refuse')
|
||||
create(:dossier, :with_entreprise, user: user, state: 'sans_suite')
|
||||
|
||||
create :invite, dossier: dossier_invite, user: user
|
||||
|
||||
|
|
|
@ -18,15 +18,15 @@ 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!(:dossier2) { create(:dossier, procedure: procedure_hier, state: 'initiated', archived: false)}
|
||||
let!(:dossier3) { create(:dossier, procedure: procedure_hier, state: 'initiated', archived: false)}
|
||||
let!(:dossier4) { create(:dossier, procedure: procedure_hier, state: 'initiated', archived: false)}
|
||||
let!(:dossier5) { create(:dossier, procedure: procedure_hier, state: 'received', archived: false)}
|
||||
let!(:dossier6) { create(:dossier, procedure: procedure_hier, state: 'closed', archived: false)}
|
||||
let!(:dossier7) { create(:dossier, procedure: procedure_hier, state: 'refused', archived: false)}
|
||||
let!(:dossier8) { create(:dossier, procedure: procedure_hier, state: 'without_continuation', archived: false)}
|
||||
let!(:dossier9) { create(:dossier, procedure: procedure_aujourdhui, state: 'initiated', 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)}
|
||||
let!(:dossier5) { create(:dossier, procedure: procedure_hier, state: 'en_instruction', 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!(:dossier8) { create(:dossier, procedure: procedure_hier, state: 'sans_suite', archived: false)}
|
||||
let!(:dossier9) { create(:dossier, procedure: procedure_aujourdhui, state: 'en_construction', archived: false)}
|
||||
|
||||
before do
|
||||
subject
|
||||
|
@ -39,15 +39,15 @@ RSpec.describe AutoArchiveProcedureJob, type: :job do
|
|||
procedure_aujourdhui.reload
|
||||
end
|
||||
|
||||
it { expect(dossier1.state).to eq 'draft' }
|
||||
it { expect(dossier2.state).to eq 'received' }
|
||||
it { expect(dossier3.state).to eq 'received' }
|
||||
it { expect(dossier4.state).to eq 'received' }
|
||||
it { expect(dossier5.state).to eq 'received' }
|
||||
it { expect(dossier6.state).to eq 'closed' }
|
||||
it { expect(dossier7.state).to eq 'refused' }
|
||||
it { expect(dossier8.state).to eq 'without_continuation' }
|
||||
it { expect(dossier9.state).to eq 'received' }
|
||||
it { expect(dossier1.state).to eq 'brouillon' }
|
||||
it { expect(dossier2.state).to eq 'en_instruction' }
|
||||
it { expect(dossier3.state).to eq 'en_instruction' }
|
||||
it { expect(dossier4.state).to eq 'en_instruction' }
|
||||
it { expect(dossier5.state).to eq 'en_instruction' }
|
||||
it { expect(dossier6.state).to eq 'accepte' }
|
||||
it { expect(dossier7.state).to eq 'refuse' }
|
||||
it { expect(dossier8.state).to eq 'sans_suite' }
|
||||
it { expect(dossier9.state).to eq 'en_instruction' }
|
||||
|
||||
it { expect(procedure_hier.archivee?).to eq true }
|
||||
it { expect(procedure_aujourdhui.archivee?).to eq true }
|
||||
|
|
|
@ -7,28 +7,28 @@ RSpec.describe AutoReceiveDossiersForProcedureJob, type: :job do
|
|||
before { Timecop.freeze(date) }
|
||||
after { Timecop.return }
|
||||
|
||||
subject { AutoReceiveDossiersForProcedureJob.new.perform(procedure_id, 'received') }
|
||||
subject { AutoReceiveDossiersForProcedureJob.new.perform(procedure_id, 'en_instruction') }
|
||||
|
||||
context "with some dossiers" do
|
||||
let(:nouveau_dossier1) { create(:dossier, :initiated) }
|
||||
let(:nouveau_dossier2) { create(:dossier, :initiated, 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(:nouveau_dossier1) { create(:dossier, :en_construction) }
|
||||
let(:nouveau_dossier2) { create(:dossier, :en_construction, procedure: nouveau_dossier1.procedure) }
|
||||
let(:dossier_recu) { create(:dossier, :en_instruction, procedure: nouveau_dossier2.procedure) }
|
||||
let(:dossier_brouillon) { create(:dossier, procedure: dossier_recu.procedure) }
|
||||
let(:procedure_id) { dossier_brouillon.procedure_id }
|
||||
|
||||
it do
|
||||
subject
|
||||
expect(nouveau_dossier1.reload.received?).to be true
|
||||
expect(nouveau_dossier1.reload.received_at).to eq(date)
|
||||
expect(nouveau_dossier1.reload.en_instruction?).to be true
|
||||
expect(nouveau_dossier1.reload.en_instruction_at).to eq(date)
|
||||
|
||||
expect(nouveau_dossier2.reload.received?).to be true
|
||||
expect(nouveau_dossier2.reload.received_at).to eq(date)
|
||||
expect(nouveau_dossier2.reload.en_instruction?).to be true
|
||||
expect(nouveau_dossier2.reload.en_instruction_at).to eq(date)
|
||||
|
||||
expect(dossier_recu.reload.received?).to be true
|
||||
expect(dossier_recu.reload.received_at).to eq(date)
|
||||
expect(dossier_recu.reload.en_instruction?).to be true
|
||||
expect(dossier_recu.reload.en_instruction_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.en_instruction_at).to eq(nil)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -112,7 +112,7 @@ describe Dossier do
|
|||
|
||||
it 'does not create default champs' do
|
||||
expect(subject).not_to receive(:build_default_champs)
|
||||
subject.update_attributes(state: 'initiated')
|
||||
subject.update_attributes(state: 'en_construction')
|
||||
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,26 +145,26 @@ 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
|
||||
let(:action) { 'initiate' }
|
||||
|
||||
it { is_expected.to eq('initiated') }
|
||||
it { is_expected.to eq('en_construction') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier is at state initiated' do
|
||||
context 'when dossier is at state en_construction' do
|
||||
before do
|
||||
dossier.initiated!
|
||||
dossier.en_construction!
|
||||
end
|
||||
|
||||
context 'when user is connect' do
|
||||
|
@ -173,13 +173,13 @@ describe Dossier do
|
|||
context 'when is update dossier informations' do
|
||||
let(:action) { 'update' }
|
||||
|
||||
it { is_expected.to eq('initiated') }
|
||||
it { is_expected.to eq('en_construction') }
|
||||
end
|
||||
|
||||
context 'when is post a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it { is_expected.to eq('initiated') }
|
||||
it { is_expected.to eq('en_construction') }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -189,20 +189,20 @@ describe Dossier do
|
|||
context 'when is post a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it { is_expected.to eq('initiated') }
|
||||
it { is_expected.to eq('en_construction') }
|
||||
end
|
||||
|
||||
context 'when is follow' do
|
||||
let(:action) { 'follow' }
|
||||
|
||||
it { is_expected.to eq 'initiated' }
|
||||
it { is_expected.to eq 'en_construction' }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier is at state received' do
|
||||
context 'when dossier is at state en_instruction' do
|
||||
before do
|
||||
dossier.received!
|
||||
dossier.en_instruction!
|
||||
end
|
||||
|
||||
context 'when user is connected' do
|
||||
|
@ -211,7 +211,7 @@ describe Dossier do
|
|||
context 'when he posts a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it { is_expected.to eq('received') }
|
||||
it { is_expected.to eq('en_instruction') }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -221,20 +221,20 @@ describe Dossier do
|
|||
context 'when he posts a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it { is_expected.to eq('received') }
|
||||
it { is_expected.to eq('en_instruction') }
|
||||
end
|
||||
|
||||
context 'when he closes the dossier' do
|
||||
let(:action) { 'close' }
|
||||
|
||||
it { is_expected.to eq('closed') }
|
||||
it { is_expected.to eq('accepte') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier is at state refused' do
|
||||
context 'when dossier is at state refuse' do
|
||||
before do
|
||||
dossier.refused!
|
||||
dossier.refuse!
|
||||
end
|
||||
|
||||
context 'when user is connected' do
|
||||
|
@ -243,7 +243,7 @@ describe Dossier do
|
|||
context 'when he posts a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it { is_expected.to eq('refused') }
|
||||
it { is_expected.to eq('refuse') }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -253,14 +253,14 @@ describe Dossier do
|
|||
context 'when he posts a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it { is_expected.to eq('refused') }
|
||||
it { is_expected.to eq('refuse') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier is at state without_continuation' do
|
||||
context 'when dossier is at state sans_suite' do
|
||||
before do
|
||||
dossier.without_continuation!
|
||||
dossier.sans_suite!
|
||||
end
|
||||
|
||||
context 'when user is connected' do
|
||||
|
@ -269,7 +269,7 @@ describe Dossier do
|
|||
context 'when he posts a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it { is_expected.to eq('without_continuation') }
|
||||
it { is_expected.to eq('sans_suite') }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -279,14 +279,14 @@ describe Dossier do
|
|||
context 'when he posts a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it { is_expected.to eq('without_continuation') }
|
||||
it { is_expected.to eq('sans_suite') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier is at state closed' do
|
||||
context 'when dossier is at state accepte' do
|
||||
before do
|
||||
dossier.closed!
|
||||
dossier.accepte!
|
||||
end
|
||||
|
||||
context 'when user is connect' do
|
||||
|
@ -295,7 +295,7 @@ describe Dossier do
|
|||
context 'when is post a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it { is_expected.to eq('closed') }
|
||||
it { is_expected.to eq('accepte') }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -305,7 +305,7 @@ describe Dossier do
|
|||
context 'when is post a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it { is_expected.to eq('closed') }
|
||||
it { is_expected.to eq('accepte') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -394,7 +394,7 @@ describe Dossier do
|
|||
let(:date1) { 1.day.ago }
|
||||
let(:date2) { 1.hour.ago }
|
||||
let(:date3) { 1.minute.ago }
|
||||
let(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure, initiated_at: date1, received_at: date2, processed_at: date3, motivation: "Motivation") }
|
||||
let(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure, en_construction_at: date1, en_instruction_at: date2, processed_at: date3, motivation: "Motivation") }
|
||||
let!(:follow) { create(:follow, gestionnaire: gestionnaire, dossier: dossier) }
|
||||
|
||||
describe '#export_headers' 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,9 +459,9 @@ describe Dossier do
|
|||
"false",
|
||||
dossier.user.email,
|
||||
"false",
|
||||
"draft",
|
||||
dossier.initiated_at,
|
||||
dossier.received_at,
|
||||
"brouillon",
|
||||
dossier.en_construction_at,
|
||||
dossier.en_instruction_at,
|
||||
dossier.processed_at,
|
||||
"Motivation",
|
||||
gestionnaire.email,
|
||||
|
@ -615,16 +615,16 @@ describe Dossier do
|
|||
describe "#text_summary" do
|
||||
let(:procedure) { create(:procedure, libelle: "Procédure", organisation: "Organisme") }
|
||||
|
||||
context 'when the dossier has been initiated' do
|
||||
let(:dossier) { create :dossier, procedure: procedure, state: 'initiated', initiated_at: "31/12/2010".to_date }
|
||||
context 'when the dossier has been en_construction' do
|
||||
let(:dossier) { create :dossier, procedure: procedure, state: 'en_construction', en_construction_at: "31/12/2010".to_date }
|
||||
|
||||
subject { dossier.text_summary }
|
||||
|
||||
it { is_expected.to eq("Dossier déposé le 31/12/2010 sur la procédure Procédure gérée par l'organisme Organisme") }
|
||||
end
|
||||
|
||||
context 'when the dossier has not been initiated' do
|
||||
let(:dossier) { create :dossier, procedure: procedure, state: 'draft' }
|
||||
context 'when the dossier has not been en_construction' do
|
||||
let(:dossier) { create :dossier, procedure: procedure, state: 'brouillon' }
|
||||
|
||||
subject { dossier.text_summary }
|
||||
|
||||
|
@ -634,7 +634,7 @@ describe Dossier do
|
|||
|
||||
describe '#avis_for' do
|
||||
let!(:procedure) { create(:procedure, :published) }
|
||||
let!(:dossier) { create(:dossier, procedure: procedure, state: :initiated) }
|
||||
let!(:dossier) { create(:dossier, procedure: procedure, state: :en_construction) }
|
||||
|
||||
let!(:gestionnaire) { create(:gestionnaire, procedures: [procedure]) }
|
||||
let!(:expert_1) { create(:gestionnaire) }
|
||||
|
@ -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 }
|
||||
|
||||
|
@ -691,41 +691,41 @@ describe Dossier do
|
|||
Timecop.freeze(beginning_of_day)
|
||||
end
|
||||
|
||||
context 'when dossier is initiated' do
|
||||
context 'when dossier is en_construction' do
|
||||
before do
|
||||
dossier.initiated!
|
||||
dossier.en_construction!
|
||||
dossier.reload
|
||||
end
|
||||
|
||||
it { expect(dossier.state).to eq('initiated') }
|
||||
it { expect(dossier.initiated_at).to eq(beginning_of_day) }
|
||||
it { expect(dossier.state).to eq('en_construction') }
|
||||
it { expect(dossier.en_construction_at).to eq(beginning_of_day) }
|
||||
|
||||
it 'should keep first initiated_at date' do
|
||||
it 'should keep first en_construction_at date' do
|
||||
Timecop.return
|
||||
dossier.received!
|
||||
dossier.initiated!
|
||||
dossier.en_instruction!
|
||||
dossier.en_construction!
|
||||
|
||||
expect(dossier.initiated_at).to eq(beginning_of_day)
|
||||
expect(dossier.en_construction_at).to eq(beginning_of_day)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier is received' do
|
||||
let(:state) { 'initiated' }
|
||||
context 'when dossier is en_instruction' do
|
||||
let(:state) { 'en_construction' }
|
||||
|
||||
before do
|
||||
dossier.received!
|
||||
dossier.en_instruction!
|
||||
dossier.reload
|
||||
end
|
||||
|
||||
it { expect(dossier.state).to eq('received') }
|
||||
it { expect(dossier.received_at).to eq(beginning_of_day) }
|
||||
it { expect(dossier.state).to eq('en_instruction') }
|
||||
it { expect(dossier.en_instruction_at).to eq(beginning_of_day) }
|
||||
|
||||
it 'should keep first received_at date if dossier is set to initiated again' do
|
||||
it 'should keep first en_instruction_at date if dossier is set to en_construction again' do
|
||||
Timecop.return
|
||||
dossier.initiated!
|
||||
dossier.received!
|
||||
dossier.en_construction!
|
||||
dossier.en_instruction!
|
||||
|
||||
expect(dossier.received_at).to eq(beginning_of_day)
|
||||
expect(dossier.en_instruction_at).to eq(beginning_of_day)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -739,31 +739,31 @@ describe Dossier do
|
|||
it { expect(dossier.processed_at).to eq(beginning_of_day) }
|
||||
end
|
||||
|
||||
context 'when dossier is closed' do
|
||||
let(:state) { 'received' }
|
||||
context 'when dossier is accepte' do
|
||||
let(:state) { 'en_instruction' }
|
||||
|
||||
it_behaves_like 'dossier is processed', 'closed'
|
||||
it_behaves_like 'dossier is processed', 'accepte'
|
||||
end
|
||||
|
||||
context 'when dossier is refused' do
|
||||
let(:state) { 'received' }
|
||||
context 'when dossier is refuse' do
|
||||
let(:state) { 'en_instruction' }
|
||||
|
||||
it_behaves_like 'dossier is processed', 'refused'
|
||||
it_behaves_like 'dossier is processed', 'refuse'
|
||||
end
|
||||
|
||||
context 'when dossier is without_continuation' do
|
||||
let(:state) { 'received' }
|
||||
context 'when dossier is sans_suite' do
|
||||
let(:state) { 'en_instruction' }
|
||||
|
||||
it_behaves_like 'dossier is processed', 'without_continuation'
|
||||
it_behaves_like 'dossier is processed', 'sans_suite'
|
||||
end
|
||||
end
|
||||
|
||||
describe '.downloadable_sorted' do
|
||||
let(:procedure) { create(:procedure) }
|
||||
let!(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: :draft) }
|
||||
let!(:dossier2) { create(:dossier, :with_entreprise, procedure: procedure, state: :initiated, initiated_at: DateTime.parse('03/01/2010')) }
|
||||
let!(:dossier3) { create(:dossier, :with_entreprise, procedure: procedure, state: :received, initiated_at: DateTime.parse('01/01/2010')) }
|
||||
let!(:dossier4) { create(:dossier, :with_entreprise, procedure: procedure, state: :received, archived: true, initiated_at: DateTime.parse('02/01/2010')) }
|
||||
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: :en_instruction, en_construction_at: DateTime.parse('01/01/2010')) }
|
||||
let!(:dossier4) { create(:dossier, :with_entreprise, procedure: procedure, state: :en_instruction, archived: true, en_construction_at: DateTime.parse('02/01/2010')) }
|
||||
|
||||
subject { procedure.dossiers.downloadable_sorted }
|
||||
|
||||
|
@ -772,19 +772,19 @@ describe Dossier do
|
|||
|
||||
describe "#send_dossier_received" do
|
||||
let(:procedure) { create(:procedure) }
|
||||
let(:dossier) { create(:dossier, procedure: procedure, state: :initiated) }
|
||||
let(:dossier) { create(:dossier, procedure: procedure, state: :en_construction) }
|
||||
|
||||
before do
|
||||
allow(NotificationMailer).to receive(:send_dossier_received).and_return(double(deliver_later: nil))
|
||||
end
|
||||
|
||||
it "sends an email when the dossier becomes received" do
|
||||
dossier.received!
|
||||
it "sends an email when the dossier becomes en_instruction" do
|
||||
dossier.en_instruction!
|
||||
expect(NotificationMailer).to have_received(:send_dossier_received).with(dossier.id)
|
||||
end
|
||||
|
||||
it "does not an email when the dossier becomes closed" do
|
||||
dossier.closed!
|
||||
it "does not an email when the dossier becomes accepte" do
|
||||
dossier.accepte!
|
||||
expect(NotificationMailer).to_not have_received(:send_dossier_received)
|
||||
end
|
||||
end
|
||||
|
@ -798,18 +798,18 @@ 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
|
||||
expect { Dossier.create(procedure: procedure, state: "initiated", 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)
|
||||
expect { Dossier.create(procedure: procedure, state: "refused", 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)
|
||||
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: "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: "refuse", 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
|
||||
|
||||
|
@ -822,8 +822,8 @@ describe Dossier do
|
|||
dossier.reload
|
||||
end
|
||||
|
||||
context 'when the dossier is in received state ' do
|
||||
let!(:dossier) { create(:dossier, procedure: procedure, state: :received) }
|
||||
context 'when the dossier is in en_instruction state ' do
|
||||
let!(:dossier) { create(:dossier, procedure: procedure, state: :en_instruction) }
|
||||
|
||||
context 'when the procedure has no attestation' do
|
||||
it { expect(dossier.attestation).to be_nil }
|
||||
|
|
|
@ -169,7 +169,7 @@ describe Gestionnaire, type: :model do
|
|||
end
|
||||
|
||||
context 'when gestionnaire follow a dossier with a notification into the procedure past in params' do
|
||||
let(:dossier) { create(:dossier, procedure: procedure, state: 'initiated') }
|
||||
let(:dossier) { create(:dossier, procedure: procedure, state: 'en_construction') }
|
||||
|
||||
before do
|
||||
create :follow, gestionnaire: gestionnaire, dossier: dossier
|
||||
|
@ -268,7 +268,7 @@ describe Gestionnaire, type: :model do
|
|||
end
|
||||
|
||||
context 'with a followed dossier' do
|
||||
let!(:dossier){create(:dossier, procedure: procedure, state: 'received')}
|
||||
let!(:dossier){create(:dossier, procedure: procedure, state: 'en_instruction')}
|
||||
let!(:follow){ create(:follow, dossier: dossier, gestionnaire: gestionnaire) }
|
||||
|
||||
context 'with 1 notification' do
|
||||
|
@ -291,7 +291,7 @@ describe Gestionnaire, type: :model do
|
|||
end
|
||||
|
||||
context 'with another dossier' do
|
||||
let!(:dossier2){create(:dossier, procedure: procedure, state: 'received')}
|
||||
let!(:dossier2){create(:dossier, procedure: procedure, state: 'en_instruction')}
|
||||
let!(:follow2){ create(:follow, dossier: dossier2, gestionnaire: gestionnaire) }
|
||||
|
||||
context 'and some notifications' do
|
||||
|
@ -351,7 +351,7 @@ describe Gestionnaire, type: :model do
|
|||
subject{ gestionnaire.can_view_dossier?(dossier.id) }
|
||||
|
||||
context 'when gestionnaire is assigned on dossier' do
|
||||
let!(:dossier){ create(:dossier, procedure: procedure, state: 'received') }
|
||||
let!(:dossier){ create(:dossier, procedure: procedure, state: 'en_instruction') }
|
||||
|
||||
it { expect(subject).to be true }
|
||||
end
|
||||
|
@ -405,7 +405,7 @@ describe Gestionnaire, type: :model do
|
|||
end
|
||||
|
||||
describe '#notifications_for_dossier' do
|
||||
let!(:dossier) { create(:dossier, :followed, state: 'initiated') }
|
||||
let!(:dossier) { create(:dossier, :followed, state: 'en_construction') }
|
||||
let(:gestionnaire) { dossier.follows.first.gestionnaire }
|
||||
|
||||
subject { gestionnaire.notifications_for_dossier(dossier) }
|
||||
|
@ -454,12 +454,12 @@ describe Gestionnaire, type: :model do
|
|||
end
|
||||
|
||||
describe '#notification_for_procedure' do
|
||||
let!(:dossier) { create(:dossier, :followed, state: 'initiated') }
|
||||
let!(:dossier) { create(:dossier, :followed, state: 'en_construction') }
|
||||
let(:gestionnaire) { dossier.follows.first.gestionnaire }
|
||||
let(:procedure) { dossier.procedure }
|
||||
let!(:gestionnaire_2) { create(:gestionnaire, procedures: [procedure]) }
|
||||
|
||||
let!(:dossier_on_procedure_2) { create(:dossier, :followed, state: 'initiated') }
|
||||
let!(:dossier_on_procedure_2) { create(:dossier, :followed, state: 'en_construction') }
|
||||
let!(:gestionnaire_on_procedure_2) { dossier_on_procedure_2.follows.first.gestionnaire }
|
||||
|
||||
before do
|
||||
|
@ -535,7 +535,7 @@ describe Gestionnaire, type: :model do
|
|||
end
|
||||
|
||||
describe '#notifications_per_procedure' do
|
||||
let!(:dossier) { create(:dossier, :followed, state: 'initiated') }
|
||||
let!(:dossier) { create(:dossier, :followed, state: 'en_construction') }
|
||||
let(:gestionnaire) { dossier.follows.first.gestionnaire }
|
||||
let(:procedure) { dossier.procedure }
|
||||
|
||||
|
@ -549,7 +549,7 @@ describe Gestionnaire, type: :model do
|
|||
end
|
||||
|
||||
describe '#mark_tab_as_seen' do
|
||||
let!(:dossier) { create(:dossier, :followed, state: 'initiated') }
|
||||
let!(:dossier) { create(:dossier, :followed, state: 'en_construction') }
|
||||
let(:gestionnaire) { dossier.follows.first.gestionnaire }
|
||||
let(:freeze_date) { DateTime.parse('12/12/2012') }
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ describe ProcedureOverview, type: :model do
|
|||
|
||||
describe 'dossiers_en_instruction_count' do
|
||||
let!(:en_instruction_dossier) do
|
||||
create(:dossier, procedure: procedure, state: :received, created_at: monday)
|
||||
create(:dossier, procedure: procedure, state: :en_instruction, created_at: monday)
|
||||
end
|
||||
|
||||
it { expect(procedure_overview.dossiers_en_instruction_count).to eq(1) }
|
||||
|
@ -20,11 +20,11 @@ describe ProcedureOverview, type: :model do
|
|||
|
||||
describe 'old_dossiers_en_instruction' do
|
||||
let!(:old_dossier_en_instruction) do
|
||||
create(:dossier, procedure: procedure, state: :received, received_at: monday - 1.month)
|
||||
create(:dossier, procedure: procedure, state: :en_instruction, en_instruction_at: monday - 1.month)
|
||||
end
|
||||
|
||||
let!(:dossier_en_instruction) do
|
||||
create(:dossier, procedure: procedure, state: :received, received_at: monday)
|
||||
create(:dossier, procedure: procedure, state: :en_instruction, en_instruction_at: monday)
|
||||
end
|
||||
|
||||
it do
|
||||
|
@ -34,7 +34,7 @@ describe ProcedureOverview, type: :model do
|
|||
|
||||
describe 'dossiers_en_construction_count' do
|
||||
let!(:dossier_en_construction) do
|
||||
create(:dossier, procedure: procedure, state: :initiated, created_at: monday)
|
||||
create(:dossier, procedure: procedure, state: :en_construction, created_at: monday)
|
||||
end
|
||||
|
||||
it { expect(procedure_overview.dossiers_en_construction_count).to eq(1) }
|
||||
|
@ -42,15 +42,15 @@ describe ProcedureOverview, type: :model do
|
|||
|
||||
describe 'created_dossiers_count' do
|
||||
let!(:created_dossier_during_the_week) do
|
||||
create(:dossier, procedure: procedure, created_at: monday, state: :received)
|
||||
create(:dossier, procedure: procedure, created_at: monday, state: :en_instruction)
|
||||
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
|
||||
create(:dossier, procedure: procedure, created_at: (monday - 1.week), state: :received)
|
||||
create(:dossier, procedure: procedure, created_at: (monday - 1.week), state: :en_instruction)
|
||||
end
|
||||
|
||||
it { expect(procedure_overview.created_dossiers_count).to eq(1) }
|
||||
|
|
|
@ -307,9 +307,9 @@ describe Procedure do
|
|||
let(:procedure) { create :procedure }
|
||||
|
||||
before do
|
||||
create :dossier, procedure: procedure, state: :initiated
|
||||
create :dossier, procedure: procedure, state: :draft
|
||||
create :dossier, procedure: procedure, state: :initiated
|
||||
create :dossier, procedure: procedure, state: :en_construction
|
||||
create :dossier, procedure: procedure, state: :brouillon
|
||||
create :dossier, procedure: procedure, state: :en_construction
|
||||
end
|
||||
|
||||
subject { procedure.total_dossier }
|
||||
|
@ -331,8 +331,8 @@ describe Procedure do
|
|||
end
|
||||
|
||||
context 'when there are some dossiers' do
|
||||
let!(:dossier){ create(:dossier, procedure: procedure, state: 'initiated') }
|
||||
let!(:dossier2){ create(:dossier, procedure: procedure, state: 'closed') }
|
||||
let!(:dossier){ create(:dossier, procedure: procedure, state: 'en_construction') }
|
||||
let!(:dossier2){ create(:dossier, procedure: procedure, state: 'accepte') }
|
||||
|
||||
it { expect(subject[:data].size).to eq(2) }
|
||||
it { expect(subject[:headers]).to eq(dossier.export_headers) }
|
||||
|
@ -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,11 +22,11 @@ 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_1) { create(:dossier, state: 'initiated', procedure: procedure_1, user: create(:user, email: 'contact@test.com')) }
|
||||
let!(:dossier_2) { create(:dossier, state: 'initiated', procedure: procedure_1, user: create(:user, email: 'plop@gmail.com')) }
|
||||
let!(:dossier_3) { create(:dossier, state: 'initiated', procedure: procedure_2, user: create(:user, email: 'peace@clap.fr')) }
|
||||
let!(:dossier_archived) { create(:dossier, state: 'initiated', procedure: procedure_1, archived: true, user: create(:user, email: 'brouillonArchived@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')) }
|
||||
let!(:dossier_archived) { create(:dossier, state: 'en_construction', procedure: procedure_1, archived: true, user: create(:user, email: 'brouillonArchived@clap.fr')) }
|
||||
|
||||
let!(:etablissement_1) { create(:etablissement, entreprise: create(:entreprise, raison_sociale: 'OCTO Academy', dossier: dossier_1), dossier: dossier_1, siret: '41636169600051') }
|
||||
let!(:etablissement_2) { create(:etablissement, entreprise: create(:entreprise, raison_sociale: 'Plop octo', dossier: dossier_2), dossier: dossier_2, siret: '41816602300012') }
|
||||
|
@ -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) }
|
||||
|
|
37
spec/serializers/dossier_serializer_spec.rb
Normal file
37
spec/serializers/dossier_serializer_spec.rb
Normal file
|
@ -0,0 +1,37 @@
|
|||
describe DossierSerializer do
|
||||
describe '#attributes' do
|
||||
subject { DossierSerializer.new(dossier).serializable_hash }
|
||||
|
||||
context 'when the dossier is en_construction' do
|
||||
let(:dossier) { create(:dossier, :en_construction) }
|
||||
|
||||
it { is_expected.to include(initiated_at: dossier.en_construction_at) }
|
||||
it { is_expected.to include(state: 'initiated') }
|
||||
end
|
||||
|
||||
context 'when the dossier is en instruction' do
|
||||
let(:dossier) { create(:dossier, :en_instruction) }
|
||||
|
||||
it { is_expected.to include(received_at: dossier.en_instruction_at) }
|
||||
it { is_expected.to include(state: 'received') }
|
||||
end
|
||||
|
||||
context 'when the dossier is accepte' do
|
||||
let(:dossier) { create(:dossier, state: :accepte) }
|
||||
|
||||
it { is_expected.to include(state: 'closed') }
|
||||
end
|
||||
|
||||
context 'when the dossier is refuse' do
|
||||
let(:dossier) { create(:dossier, state: :refuse) }
|
||||
|
||||
it { is_expected.to include(state: 'refused') }
|
||||
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
|
|
@ -1,6 +1,42 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe DossierTableExportSerializer do
|
||||
describe '#attributes' do
|
||||
subject { DossierTableExportSerializer.new(dossier).serializable_hash }
|
||||
|
||||
context 'when the dossier is en_construction' do
|
||||
let(:dossier) { create(:dossier, :en_construction) }
|
||||
|
||||
it { is_expected.to include(initiated_at: dossier.en_construction_at) }
|
||||
it { is_expected.to include(state: 'initiated') }
|
||||
end
|
||||
|
||||
context 'when the dossier is en instruction' do
|
||||
let(:dossier) { create(:dossier, :en_instruction) }
|
||||
|
||||
it { is_expected.to include(received_at: dossier.en_instruction_at) }
|
||||
it { is_expected.to include(state: 'received') }
|
||||
end
|
||||
|
||||
context 'when the dossier is accepte' do
|
||||
let(:dossier) { create(:dossier, state: :accepte) }
|
||||
|
||||
it { is_expected.to include(state: 'closed') }
|
||||
end
|
||||
|
||||
context 'when the dossier is refuse' do
|
||||
let(:dossier) { create(:dossier, state: :refuse) }
|
||||
|
||||
it { is_expected.to include(state: 'refused') }
|
||||
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
|
||||
|
||||
describe '#emails_accompagnateurs' do
|
||||
let(:gestionnaire){ create(:gestionnaire) }
|
||||
let(:gestionnaire2) { create :gestionnaire}
|
||||
|
|
11
spec/serializers/dossiers_serializer_spec.rb
Normal file
11
spec/serializers/dossiers_serializer_spec.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
describe DossiersSerializer do
|
||||
describe '#attributes' do
|
||||
subject { DossiersSerializer.new(dossier).serializable_hash }
|
||||
|
||||
context 'when the dossier is en_construction' do
|
||||
let(:dossier) { create(:dossier, :en_construction) }
|
||||
|
||||
it { is_expected.to include(initiated_at: dossier.en_construction_at) }
|
||||
end
|
||||
end
|
||||
end
|
|
@ -345,17 +345,17 @@ describe DossiersListGestionnaireService do
|
|||
|
||||
describe 'state filter methods' do
|
||||
let!(:procedure) { create :procedure }
|
||||
let!(:dossier) { create(:dossier, procedure: procedure, state: 'draft') }
|
||||
let!(:dossier2) { create(:dossier, procedure: procedure, state: 'initiated') } #nouveaux
|
||||
let!(:dossier3) { create(:dossier, procedure: procedure, state: 'initiated') } #nouveaux
|
||||
let!(:dossier6) { create(:dossier, procedure: procedure, state: 'received') } #a_instruire
|
||||
let!(:dossier7) { create(:dossier, procedure: procedure, state: 'received') } #a_instruire
|
||||
let!(:dossier8) { create(:dossier, procedure: procedure, state: 'closed') } #termine
|
||||
let!(:dossier9) { create(:dossier, procedure: procedure, state: 'refused') } #termine
|
||||
let!(:dossier10) { create(:dossier, procedure: procedure, state: 'without_continuation') } #termine
|
||||
let!(:dossier11) { create(:dossier, procedure: procedure, state: 'closed') } #termine
|
||||
let!(:dossier12) { create(:dossier, procedure: procedure, state: 'initiated', archived: true) } #a_traiter #archived
|
||||
let!(:dossier14) { create(:dossier, procedure: procedure, state: 'closed', archived: true) } #termine #archived
|
||||
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: '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!(:dossier9) { create(:dossier, procedure: procedure, state: 'refuse') } #termine
|
||||
let!(:dossier10) { create(:dossier, procedure: procedure, state: 'sans_suite') } #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!(:dossier14) { create(:dossier, procedure: procedure, state: 'accepte', archived: true) } #termine #archived
|
||||
|
||||
describe '#termine' do
|
||||
subject { DossiersListGestionnaireService.new(gestionnaire, liste, procedure).termine }
|
||||
|
|
|
@ -13,18 +13,18 @@ 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
|
||||
|
||||
describe 'initiated' do
|
||||
let(:state) { 'initiated' }
|
||||
describe 'en_construction' do
|
||||
let(:state) { 'en_construction' }
|
||||
it { is_expected.to be_falsey }
|
||||
end
|
||||
|
||||
describe 'closed' do
|
||||
let(:state) { 'closed' }
|
||||
describe 'accepte' do
|
||||
let(:state) { 'accepte' }
|
||||
it { is_expected.to be_falsey }
|
||||
end
|
||||
end
|
||||
|
@ -33,18 +33,18 @@ 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
|
||||
|
||||
describe 'initiated' do
|
||||
let(:state) { 'initiated' }
|
||||
describe 'en_construction' do
|
||||
let(:state) { 'en_construction' }
|
||||
it { is_expected.to be_falsey }
|
||||
end
|
||||
|
||||
describe 'closed' do
|
||||
let(:state) { 'closed' }
|
||||
describe 'accepte' do
|
||||
let(:state) { 'accepte' }
|
||||
it { is_expected.to be_falsey }
|
||||
end
|
||||
end
|
||||
|
@ -52,18 +52,18 @@ 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
|
||||
|
||||
describe 'initiated' do
|
||||
let(:state) { 'initiated' }
|
||||
describe 'en_construction' do
|
||||
let(:state) { 'en_construction' }
|
||||
it { is_expected.to be_truthy }
|
||||
end
|
||||
|
||||
describe 'closed' do
|
||||
let(:state) { 'closed' }
|
||||
describe 'accepte' do
|
||||
let(:state) { 'accepte' }
|
||||
it { is_expected.to be_falsey }
|
||||
end
|
||||
end
|
||||
|
@ -72,18 +72,18 @@ 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
|
||||
|
||||
describe 'initiated' do
|
||||
let(:state) { 'initiated' }
|
||||
describe 'en_construction' do
|
||||
let(:state) { 'en_construction' }
|
||||
it { is_expected.to be_truthy }
|
||||
end
|
||||
|
||||
describe 'closed' do
|
||||
let(:state) { 'closed' }
|
||||
describe 'accepte' do
|
||||
let(:state) { 'accepte' }
|
||||
it { is_expected.to be_falsey }
|
||||
end
|
||||
end
|
||||
|
@ -91,18 +91,18 @@ 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
|
||||
|
||||
describe 'initiated' do
|
||||
let(:state) { 'initiated' }
|
||||
describe 'en_construction' do
|
||||
let(:state) { 'en_construction' }
|
||||
it { is_expected.to be_truthy }
|
||||
end
|
||||
|
||||
describe 'closed' do
|
||||
let(:state) { 'closed' }
|
||||
describe 'accepte' do
|
||||
let(:state) { 'accepte' }
|
||||
it { is_expected.to be_truthy }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -45,7 +45,7 @@ describe 'admin/previsualisations/show.html.haml', type: :view do
|
|||
|
||||
context 'si la page précédente est recapitularif' do
|
||||
before do
|
||||
dossier.initiated!
|
||||
dossier.en_construction!
|
||||
dossier.reload
|
||||
render
|
||||
end
|
||||
|
|
|
@ -6,11 +6,11 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
|
|||
|
||||
let!(:procedure) { create(:procedure, :published, administrateur: administrateur) }
|
||||
|
||||
let!(:decorate_dossier_initiated) { create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated').decorate }
|
||||
let!(:decorate_dossier_received) { create(:dossier, :with_entreprise, procedure: procedure, state: 'received').decorate }
|
||||
let!(:decorate_dossier_closed) { create(:dossier, :with_entreprise, procedure: procedure, state: 'closed').decorate }
|
||||
let!(:decorate_dossier_refused) { create(:dossier, :with_entreprise, procedure: procedure, state: 'refused').decorate }
|
||||
let!(:decorate_dossier_without_continuation) { create(:dossier, :with_entreprise, procedure: procedure, state: 'without_continuation').decorate }
|
||||
let!(:decorate_dossier_en_construction) { create(:dossier, :with_entreprise, procedure: procedure, state: 'en_construction').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_refuse) { create(:dossier, :with_entreprise, procedure: procedure, state: 'refuse').decorate }
|
||||
let!(:decorate_dossier_sans_suite) { create(:dossier, :with_entreprise, procedure: procedure, state: 'sans_suite').decorate }
|
||||
|
||||
let(:dossiers_list_facade) { DossiersListFacades.new gestionnaire, nil }
|
||||
|
||||
|
@ -19,10 +19,10 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
|
|||
let(:all_state_dossiers_list) { dossiers_list_facade.service.all_state }
|
||||
|
||||
before do
|
||||
decorate_dossier_received.entreprise.update_column(:raison_sociale, 'plup')
|
||||
decorate_dossier_closed.entreprise.update_column(:raison_sociale, 'plyp')
|
||||
decorate_dossier_refused.entreprise.update_column(:raison_sociale, 'plzp')
|
||||
decorate_dossier_without_continuation.entreprise.update_column(:raison_sociale, 'plnp')
|
||||
decorate_dossier_en_instruction.entreprise.update_column(:raison_sociale, 'plup')
|
||||
decorate_dossier_accepte.entreprise.update_column(:raison_sociale, 'plyp')
|
||||
decorate_dossier_refuse.entreprise.update_column(:raison_sociale, 'plzp')
|
||||
decorate_dossier_sans_suite.entreprise.update_column(:raison_sociale, 'plnp')
|
||||
|
||||
create :preference_list_dossier,
|
||||
gestionnaire: gestionnaire,
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
|||
|
||||
describe 'backoffice/dossiers/show.html.haml', type: :view do
|
||||
let!(:dossier) { create(:dossier, :with_entreprise, state: state, motivation: "Motivation de décision") }
|
||||
let(:state) { 'closed' }
|
||||
let(:state) { 'accepte' }
|
||||
let(:dossier_id) { dossier.id }
|
||||
let(:gestionnaire) { create(:gestionnaire) }
|
||||
|
||||
|
|
|
@ -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) }
|
||||
|
@ -28,8 +28,8 @@ describe 'layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.htm
|
|||
it { expect(rendered).to have_link('Passer en instruction') }
|
||||
end
|
||||
|
||||
context 'when dossier have state initiated' do
|
||||
let(:state) { 'initiated' }
|
||||
context 'when dossier have state en_construction' do
|
||||
let(:state) { 'en_construction' }
|
||||
|
||||
before do
|
||||
render
|
||||
|
@ -40,8 +40,8 @@ describe 'layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.htm
|
|||
include_examples 'button Passer en instruction is present'
|
||||
end
|
||||
|
||||
context 'when dossier have state received' do
|
||||
let(:state) { 'received' }
|
||||
context 'when dossier have state en_instruction' do
|
||||
let(:state) { 'en_instruction' }
|
||||
|
||||
before do
|
||||
render
|
||||
|
@ -56,8 +56,8 @@ describe 'layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.htm
|
|||
end
|
||||
end
|
||||
|
||||
context 'when dossier have state closed' do
|
||||
let(:state) { 'closed' }
|
||||
context 'when dossier have state accepte' do
|
||||
let(:state) { 'accepte' }
|
||||
|
||||
before do
|
||||
render
|
||||
|
@ -72,8 +72,8 @@ describe 'layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.htm
|
|||
end
|
||||
end
|
||||
|
||||
context 'when dossier have state without_continuation' do
|
||||
let(:state) { 'without_continuation' }
|
||||
context 'when dossier have state sans_suite' do
|
||||
let(:state) { 'sans_suite' }
|
||||
|
||||
before do
|
||||
render
|
||||
|
@ -88,8 +88,8 @@ describe 'layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.htm
|
|||
end
|
||||
end
|
||||
|
||||
context 'when dossier have state refused' do
|
||||
let(:state) { 'refused' }
|
||||
context 'when dossier have state refuse' do
|
||||
let(:state) { 'refuse' }
|
||||
|
||||
before do
|
||||
render
|
||||
|
|
|
@ -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
|
||||
|
@ -11,8 +11,8 @@ describe 'layouts/left_panels/_left_panel_users_recapitulatifcontroller_show.htm
|
|||
end
|
||||
|
||||
context 'buttons to change dossier state' do
|
||||
context 'when dossier state is initiated' do
|
||||
let(:state) { 'initiated' }
|
||||
context 'when dossier state is en_construction' do
|
||||
let(:state) { 'en_construction' }
|
||||
before do
|
||||
render
|
||||
end
|
||||
|
@ -20,8 +20,8 @@ describe 'layouts/left_panels/_left_panel_users_recapitulatifcontroller_show.htm
|
|||
it { expect(rendered).to have_content('En construction') }
|
||||
end
|
||||
|
||||
context 'when dossier state is closed' do
|
||||
let(:state) { 'closed' }
|
||||
context 'when dossier state is accepte' do
|
||||
let(:state) { 'accepte' }
|
||||
|
||||
before do
|
||||
render
|
||||
|
@ -34,8 +34,8 @@ describe 'layouts/left_panels/_left_panel_users_recapitulatifcontroller_show.htm
|
|||
end
|
||||
end
|
||||
|
||||
context 'when dossier state is refused' do
|
||||
let(:state) { 'refused' }
|
||||
context 'when dossier state is refuse' do
|
||||
let(:state) { 'refuse' }
|
||||
|
||||
before do
|
||||
render
|
||||
|
@ -48,8 +48,8 @@ describe 'layouts/left_panels/_left_panel_users_recapitulatifcontroller_show.htm
|
|||
end
|
||||
end
|
||||
|
||||
context 'when dossier state is without_continuation' do
|
||||
let(:state) { 'without_continuation' }
|
||||
context 'when dossier state is sans_suite' do
|
||||
let(:state) { 'sans_suite' }
|
||||
|
||||
before do
|
||||
render
|
||||
|
|
|
@ -3,7 +3,7 @@ describe 'new_gestionnaire/dossiers/print.html.haml', type: :view do
|
|||
|
||||
context "with a dossier" do
|
||||
let(:current_gestionnaire) { create(:gestionnaire) }
|
||||
let(:dossier) { create(:dossier, :received) }
|
||||
let(:dossier) { create(:dossier, :en_instruction) }
|
||||
|
||||
before do
|
||||
assign(:dossier, dossier)
|
||||
|
|
|
@ -4,7 +4,7 @@ describe 'new_gestionnaire/dossiers/show.html.haml', type: :view do
|
|||
let(:current_gestionnaire) { create(:gestionnaire) }
|
||||
let(:individual) { nil }
|
||||
let(:entreprise) { nil }
|
||||
let(:dossier) { create(:dossier, :initiated, entreprise: entreprise, individual: individual) }
|
||||
let(:dossier) { create(:dossier, :en_construction, entreprise: entreprise, individual: individual) }
|
||||
|
||||
before do
|
||||
assign(:dossier, dossier)
|
||||
|
|
|
@ -14,7 +14,7 @@ describe 'new_gestionnaire/procedures/_download_dossiers.html.haml', type: :view
|
|||
end
|
||||
|
||||
context "when procedure has at least 1 dossier en construction" do
|
||||
let!(:dossier) { create(:dossier, :initiated, procedure: procedure) }
|
||||
let!(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
|
||||
it { is_expected.to include("Télécharger tous les dossiers") }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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 }
|
||||
|
||||
|
@ -38,7 +38,7 @@ describe 'users/carte/show.html.haml', type: :view do
|
|||
end
|
||||
|
||||
context 'si la page précédente est recapitularif' do
|
||||
let(:state) { 'initiated' }
|
||||
let(:state) { 'en_construction' }
|
||||
|
||||
it 'le bouton "Etape suivante" n\'est pas présent' do
|
||||
expect(rendered).to_not have_selector('#etape_suivante')
|
||||
|
|
|
@ -42,7 +42,7 @@ describe 'users/description/show.html.haml', type: :view do
|
|||
|
||||
context 'si la page précédente est recapitularif' do
|
||||
before do
|
||||
dossier.initiated!
|
||||
dossier.en_construction!
|
||||
dossier.reload
|
||||
render
|
||||
end
|
||||
|
|
|
@ -3,12 +3,12 @@ require 'spec_helper'
|
|||
describe 'users/dossiers/index.html.haml', type: :view do
|
||||
let(:user) { create(:user) }
|
||||
|
||||
let!(:decorate_dossier_initiated) { create(:dossier, :with_entreprise, user: user, state: 'initiated').decorate }
|
||||
let!(:decorate_dossier_received) { create(:dossier, :with_entreprise, user: user, state: 'received').decorate }
|
||||
let!(:decorate_dossier_closed) { create(:dossier, :with_entreprise, user: user, state: 'closed').decorate }
|
||||
let!(:decorate_dossier_refused) { create(:dossier, :with_entreprise, user: user, state: 'refused').decorate }
|
||||
let!(:decorate_dossier_without_continuation) { create(:dossier, :with_entreprise, user: user, state: 'without_continuation').decorate }
|
||||
let!(:decorate_dossier_invite) { create(:dossier, :with_entreprise, user: create(:user), state: 'initiated').decorate }
|
||||
let!(:decorate_dossier_en_construction) { create(:dossier, :with_entreprise, user: user, state: 'en_construction').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_refuse) { create(:dossier, :with_entreprise, user: user, state: 'refuse').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 }
|
||||
|
||||
before do
|
||||
create :invite, dossier: decorate_dossier_invite, user: user
|
||||
|
@ -45,7 +45,7 @@ describe 'users/dossiers/index.html.haml', type: :view do
|
|||
let(:liste) { 'a_traiter' }
|
||||
|
||||
it_behaves_like 'check_tab_content' do
|
||||
let(:decorate_dossier_at_check) { decorate_dossier_initiated }
|
||||
let(:decorate_dossier_at_check) { decorate_dossier_en_construction }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -56,7 +56,7 @@ describe 'users/dossiers/index.html.haml', type: :view do
|
|||
let(:liste) { 'en_instruction' }
|
||||
|
||||
it_behaves_like 'check_tab_content' do
|
||||
let(:decorate_dossier_at_check) { decorate_dossier_received }
|
||||
let(:decorate_dossier_at_check) { decorate_dossier_en_instruction }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -67,15 +67,15 @@ describe 'users/dossiers/index.html.haml', type: :view do
|
|||
let(:liste) { 'termine' }
|
||||
|
||||
it_behaves_like 'check_tab_content' do
|
||||
let(:decorate_dossier_at_check) { decorate_dossier_closed }
|
||||
let(:decorate_dossier_at_check) { decorate_dossier_accepte }
|
||||
end
|
||||
|
||||
it_behaves_like 'check_tab_content' do
|
||||
let(:decorate_dossier_at_check) { decorate_dossier_refused }
|
||||
let(:decorate_dossier_at_check) { decorate_dossier_refuse }
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -59,8 +59,8 @@ describe 'users/recapitulatif/show.html.haml', type: :view do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when dossier state is initiated' do
|
||||
let(:state) { 'initiated' }
|
||||
context 'when dossier state is en_construction' do
|
||||
let(:state) { 'en_construction' }
|
||||
before do
|
||||
render
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue