[fix #504] Dossier: initiated -> en_construction
The change must not impact the api
This commit is contained in:
parent
461dd9e843
commit
56545933a9
72 changed files with 261 additions and 187 deletions
|
@ -179,7 +179,7 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
|
||||||
def reopen
|
def reopen
|
||||||
create_dossier_facade params[:dossier_id]
|
create_dossier_facade params[:dossier_id]
|
||||||
|
|
||||||
@facade.dossier.initiated!
|
@facade.dossier.en_construction!
|
||||||
flash.notice = 'Dossier repassé en construction.'
|
flash.notice = 'Dossier repassé en construction.'
|
||||||
|
|
||||||
redirect_to backoffice_dossier_path(id: @facade.dossier.id)
|
redirect_to backoffice_dossier_path(id: @facade.dossier.id)
|
||||||
|
|
|
@ -69,7 +69,7 @@ module NewGestionnaire
|
||||||
end
|
end
|
||||||
|
|
||||||
def repasser_en_construction
|
def repasser_en_construction
|
||||||
dossier.initiated!
|
dossier.en_construction!
|
||||||
flash.notice = 'Dossier repassé en construction.'
|
flash.notice = 'Dossier repassé en construction.'
|
||||||
|
|
||||||
redirect_to dossier_path(procedure, dossier)
|
redirect_to dossier_path(procedure, dossier)
|
||||||
|
|
|
@ -13,8 +13,8 @@ class StatsController < ApplicationController
|
||||||
@procedures_cumulative = cumulative_hash(procedures, :published_at)
|
@procedures_cumulative = cumulative_hash(procedures, :published_at)
|
||||||
@procedures_in_the_last_4_months = last_four_months_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_cumulative = cumulative_hash(dossiers, :en_construction_at)
|
||||||
@dossiers_in_the_last_4_months = last_four_months_hash(dossiers, :initiated_at)
|
@dossiers_in_the_last_4_months = last_four_months_hash(dossiers, :en_construction_at)
|
||||||
|
|
||||||
@procedures_count_per_administrateur = procedures_count_per_administrateur(procedures)
|
@procedures_count_per_administrateur = procedures_count_per_administrateur(procedures)
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ class StatsController < ApplicationController
|
||||||
|
|
||||||
processed_dossiers = dossiers
|
processed_dossiers = dossiers
|
||||||
.where(:processed_at => min_date..max_date)
|
.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
|
# Group dossiers by month
|
||||||
processed_dossiers_by_month = processed_dossiers
|
processed_dossiers_by_month = processed_dossiers
|
||||||
|
@ -137,7 +137,7 @@ class StatsController < ApplicationController
|
||||||
|
|
||||||
processed_dossiers = dossiers
|
processed_dossiers = dossiers
|
||||||
.where(:processed_at => min_date..max_date)
|
.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
|
# Group dossiers by month
|
||||||
processed_dossiers_by_month = processed_dossiers
|
processed_dossiers_by_month = processed_dossiers
|
||||||
|
|
|
@ -61,7 +61,7 @@ class Users::CarteController < UsersController
|
||||||
|
|
||||||
def self.route_authorization
|
def self.route_authorization
|
||||||
{
|
{
|
||||||
states: [:draft, :initiated],
|
states: [:draft, :en_construction],
|
||||||
api_carto: true
|
api_carto: true
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,7 +14,7 @@ class Users::DescriptionController < UsersController
|
||||||
|
|
||||||
@headers = @champs.select { |c| c.type_champ == 'header_section' }
|
@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')
|
flash[:alert] = t('errors.messages.procedure_archived')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class Users::DescriptionController < UsersController
|
||||||
dossier = current_user_dossier
|
dossier = current_user_dossier
|
||||||
procedure = dossier.procedure
|
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]
|
ChampsService.save_champs(dossier.champs, params) if params[:champs]
|
||||||
|
|
||||||
|
@ -51,8 +51,8 @@ class Users::DescriptionController < UsersController
|
||||||
redirect_to url_for(controller: :dossiers, action: :index, liste: :brouillon)
|
redirect_to url_for(controller: :dossiers, action: :index, liste: :brouillon)
|
||||||
else
|
else
|
||||||
if dossier.draft?
|
if dossier.draft?
|
||||||
dossier.initiated!
|
|
||||||
NotificationMailer.send_notification(dossier, procedure.initiated_mail_template).deliver_now!
|
NotificationMailer.send_notification(dossier, procedure.initiated_mail_template).deliver_now!
|
||||||
|
dossier.en_construction!
|
||||||
end
|
end
|
||||||
flash.notice = 'Félicitations, votre demande a bien été enregistrée.'
|
flash.notice = 'Félicitations, votre demande a bien été enregistrée.'
|
||||||
redirect_to url_for(controller: :recapitulatif, action: :show, dossier_id: dossier.id)
|
redirect_to url_for(controller: :recapitulatif, action: :show, dossier_id: dossier.id)
|
||||||
|
@ -93,7 +93,7 @@ class Users::DescriptionController < UsersController
|
||||||
|
|
||||||
def self.route_authorization
|
def self.route_authorization
|
||||||
{
|
{
|
||||||
states: [:draft, :initiated]
|
states: [:draft, :en_construction]
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ class Users::RecapitulatifController < UsersController
|
||||||
|
|
||||||
def self.route_authorization
|
def self.route_authorization
|
||||||
{
|
{
|
||||||
states: [:initiated, :received, :without_continuation, :closed, :refused]
|
states: [:en_construction, :received, :without_continuation, :closed, :refused]
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class Dossier < ActiveRecord::Base
|
class Dossier < ActiveRecord::Base
|
||||||
enum state: {
|
enum state: {
|
||||||
draft: 'draft',
|
draft: 'draft',
|
||||||
initiated: 'initiated',
|
en_construction: 'en_construction',
|
||||||
received: 'received',
|
received: 'received',
|
||||||
closed: 'closed',
|
closed: 'closed',
|
||||||
refused: 'refused',
|
refused: 'refused',
|
||||||
|
@ -9,8 +9,8 @@ class Dossier < ActiveRecord::Base
|
||||||
}
|
}
|
||||||
|
|
||||||
BROUILLON = %w(draft)
|
BROUILLON = %w(draft)
|
||||||
NOUVEAUX = %w(initiated)
|
NOUVEAUX = %w(en_construction)
|
||||||
EN_CONSTRUCTION = %w(initiated)
|
EN_CONSTRUCTION = %w(en_construction)
|
||||||
EN_INSTRUCTION = %w(received)
|
EN_INSTRUCTION = %w(received)
|
||||||
EN_CONSTRUCTION_OU_INSTRUCTION = EN_CONSTRUCTION + EN_INSTRUCTION
|
EN_CONSTRUCTION_OU_INSTRUCTION = EN_CONSTRUCTION + EN_INSTRUCTION
|
||||||
TERMINE = %w(closed refused without_continuation)
|
TERMINE = %w(closed refused without_continuation)
|
||||||
|
@ -58,7 +58,7 @@ class Dossier < ActiveRecord::Base
|
||||||
scope :nouveaux, -> { not_archived.state_nouveaux }
|
scope :nouveaux, -> { not_archived.state_nouveaux }
|
||||||
scope :en_instruction, -> { not_archived.state_en_instruction }
|
scope :en_instruction, -> { not_archived.state_en_instruction }
|
||||||
scope :termine, -> { not_archived.state_termine }
|
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 :en_cours, -> { not_archived.state_en_construction_ou_instruction }
|
||||||
scope :without_followers, -> { left_outer_joins(:follows).where(follows: { id: nil }) }
|
scope :without_followers, -> { left_outer_joins(:follows).where(follows: { id: nil }) }
|
||||||
scope :with_unread_notifications, -> { where(notifications: { already_read: false }) }
|
scope :with_unread_notifications, -> { where(notifications: { already_read: false }) }
|
||||||
|
@ -158,7 +158,7 @@ class Dossier < ActiveRecord::Base
|
||||||
case action
|
case action
|
||||||
when 'initiate'
|
when 'initiate'
|
||||||
if draft?
|
if draft?
|
||||||
initiated!
|
en_construction!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
when 'gestionnaire'
|
when 'gestionnaire'
|
||||||
|
@ -294,7 +294,7 @@ class Dossier < ActiveRecord::Base
|
||||||
(invites_user.pluck :email).include? email
|
(invites_user.pluck :email).include? email
|
||||||
end
|
end
|
||||||
|
|
||||||
def can_be_initiated?
|
def can_be_en_construction?
|
||||||
!(procedure.archivee? && draft?)
|
!(procedure.archivee? && draft?)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ class Dossier < ActiveRecord::Base
|
||||||
else
|
else
|
||||||
parts = [
|
parts = [
|
||||||
"Dossier déposé le ",
|
"Dossier déposé le ",
|
||||||
initiated_at.localtime.strftime("%d/%m/%Y"),
|
en_construction_at.localtime.strftime("%d/%m/%Y"),
|
||||||
" sur la procédure ",
|
" sur la procédure ",
|
||||||
procedure.libelle,
|
procedure.libelle,
|
||||||
" gérée par l'organisme ",
|
" gérée par l'organisme ",
|
||||||
|
@ -388,8 +388,8 @@ class Dossier < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_state_dates
|
def update_state_dates
|
||||||
if initiated? && !self.initiated_at
|
if en_construction? && !self.en_construction_at
|
||||||
self.initiated_at = DateTime.now
|
self.en_construction_at = DateTime.now
|
||||||
elsif received? && !self.received_at
|
elsif received? && !self.received_at
|
||||||
self.received_at = DateTime.now
|
self.received_at = DateTime.now
|
||||||
elsif TERMINE.include?(state)
|
elsif TERMINE.include?(state)
|
||||||
|
|
|
@ -20,7 +20,7 @@ class ProcedureOverview
|
||||||
@old_dossiers_en_construction = procedure
|
@old_dossiers_en_construction = procedure
|
||||||
.dossiers
|
.dossiers
|
||||||
.state_en_construction
|
.state_en_construction
|
||||||
.where('initiated_at < ?', 1.week.ago)
|
.where('en_construction_at < ?', 1.week.ago)
|
||||||
|
|
||||||
@created_dossiers_count = procedure
|
@created_dossiers_count = procedure
|
||||||
.dossiers
|
.dossiers
|
||||||
|
|
|
@ -35,10 +35,23 @@ class DossierSerializer < ActiveModel::Serializer
|
||||||
object.user.try(:email)
|
object.user.try(:email)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def state
|
||||||
|
case object.state
|
||||||
|
when 'en_construction'
|
||||||
|
'initiated'
|
||||||
|
else
|
||||||
|
object.state
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def simplified_state
|
def simplified_state
|
||||||
object.decorate.display_state
|
object.decorate.display_state
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def initiated_at
|
||||||
|
object.en_construction_at
|
||||||
|
end
|
||||||
|
|
||||||
def accompagnateurs
|
def accompagnateurs
|
||||||
object.followers_gestionnaires.pluck(:email)
|
object.followers_gestionnaires.pluck(:email)
|
||||||
end
|
end
|
||||||
|
|
|
@ -22,6 +22,19 @@ class DossierTableExportSerializer < ActiveModel::Serializer
|
||||||
object.user.try(:email)
|
object.user.try(:email)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def state
|
||||||
|
case object.state
|
||||||
|
when 'en_construction'
|
||||||
|
'initiated'
|
||||||
|
else
|
||||||
|
object.state
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def initiated_at
|
||||||
|
object.en_construction_at
|
||||||
|
end
|
||||||
|
|
||||||
def individual_prenom
|
def individual_prenom
|
||||||
object.individual.try(:prenom)
|
object.individual.try(:prenom)
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,4 +2,8 @@ class DossiersSerializer < ActiveModel::Serializer
|
||||||
attributes :id,
|
attributes :id,
|
||||||
:updated_at,
|
:updated_at,
|
||||||
:initiated_at
|
:initiated_at
|
||||||
|
|
||||||
|
def initiated_at
|
||||||
|
object.en_construction_at
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
.col-xs-8.title-no-expanse
|
.col-xs-8.title-no-expanse
|
||||||
.carret-right
|
.carret-right
|
||||||
INFORMATIONS DU DEMANDEUR
|
INFORMATIONS DU DEMANDEUR
|
||||||
- if !@current_gestionnaire && ["draft", "initiated"].include?(@facade.dossier.state)
|
- if !@current_gestionnaire && ["draft", "en_construction"].include?(@facade.dossier.state)
|
||||||
%a#add_siret.action{ href: users_dossier_add_siret_path(dossier_id: @facade.dossier.id) }
|
%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
|
.col-lg-4.col-md-4.col-sm-4.col-xs-4.action
|
||||||
Renseigner un SIRET
|
Renseigner un SIRET
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
- if current_gestionnaire && current_gestionnaire.assigned_on_procedure?(@facade.dossier.procedure_id)
|
- if current_gestionnaire && current_gestionnaire.assigned_on_procedure?(@facade.dossier.procedure_id)
|
||||||
#action-block
|
#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 ?" }
|
= 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.received?
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
%div{ style: 'text-align: right;' }
|
%div{ style: 'text-align: right;' }
|
||||||
%h6 Tous les champs portant un * sont obligatoires.
|
%h6 Tous les champs portant un * sont obligatoires.
|
||||||
|
|
||||||
- if !@dossier.can_be_initiated?
|
- if !@dossier.can_be_en_construction?
|
||||||
.alert.alert-danger
|
.alert.alert-danger
|
||||||
= t('errors.messages.procedure_archived')
|
= t('errors.messages.procedure_archived')
|
||||||
- elsif !@dossier.draft?
|
- elsif !@dossier.draft?
|
||||||
|
|
|
@ -9,7 +9,7 @@ fr:
|
||||||
date_previsionnelle: "La date de début prévisionnelle"
|
date_previsionnelle: "La date de début prévisionnelle"
|
||||||
state:
|
state:
|
||||||
draft: "Brouillon"
|
draft: "Brouillon"
|
||||||
initiated: "En construction"
|
en_construction: "En construction"
|
||||||
received: "En instruction"
|
received: "En instruction"
|
||||||
closed: "Accepté"
|
closed: "Accepté"
|
||||||
refused: "Refusé"
|
refused: "Refusé"
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class RenameDossierInitiatedByEnConstruction < ActiveRecord::Migration[5.0]
|
||||||
|
def change
|
||||||
|
rename_column :dossiers, :initiated_at, :en_construction_at
|
||||||
|
end
|
||||||
|
end
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20171205151128) do
|
ActiveRecord::Schema.define(version: 20171214112701) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
@ -194,7 +194,7 @@ ActiveRecord::Schema.define(version: 20171205151128) do
|
||||||
t.text "json_latlngs"
|
t.text "json_latlngs"
|
||||||
t.boolean "archived", default: false
|
t.boolean "archived", default: false
|
||||||
t.boolean "mandataire_social", default: false
|
t.boolean "mandataire_social", default: false
|
||||||
t.datetime "initiated_at"
|
t.datetime "en_construction_at"
|
||||||
t.datetime "received_at"
|
t.datetime "received_at"
|
||||||
t.datetime "processed_at"
|
t.datetime "processed_at"
|
||||||
t.text "motivation"
|
t.text "motivation"
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
namespace :'2017_12_04_translate_dossier_state_to_french' do
|
||||||
|
task en_construction: :environment do
|
||||||
|
Dossier.unscoped.where(state: 'initiated').update_all(state: 'en_construction')
|
||||||
|
end
|
||||||
|
end
|
|
@ -25,7 +25,7 @@ describe API::V1::DossiersController do
|
||||||
context 'when procedure is found and belongs to admin' do
|
context 'when procedure is found and belongs to admin' do
|
||||||
let(:procedure_id) { procedure.id }
|
let(:procedure_id) { procedure.id }
|
||||||
let(:date_creation) { Time.utc(2008, 9, 1, 10, 5, 0) }
|
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) }
|
let(:body) { JSON.parse(retour.body, symbolize_names: true) }
|
||||||
|
|
||||||
it 'return REST code 200', :show_in_doc do
|
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
|
context 'when there are multiple pages' do
|
||||||
let(:retour) { get :index, params: {token: admin.api_token, procedure_id: procedure_id, page: 2} }
|
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!(:dossier1) { create(:dossier, :with_entreprise, procedure: procedure, state: 'en_construction') }
|
||||||
let!(:dossier2) { create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated') }
|
let!(:dossier2) { create(:dossier, :with_entreprise, procedure: procedure, state: 'en_construction') }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
allow(Dossier).to receive(:per_page).and_return(1)
|
allow(Dossier).to receive(:per_page).and_return(1)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe Backoffice::CommentairesController, type: :controller do
|
describe Backoffice::CommentairesController, type: :controller do
|
||||||
let(:dossier) { create(:dossier, :initiated) }
|
let(:dossier) { create(:dossier, :en_construction) }
|
||||||
let(:dossier_id) { dossier.id }
|
let(:dossier_id) { dossier.id }
|
||||||
let(:email_commentaire) { 'test@test.com' }
|
let(:email_commentaire) { 'test@test.com' }
|
||||||
let(:texte_commentaire) { 'Commentaire de test' }
|
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
|
describe 'change dossier state after post a comment' do
|
||||||
context 'gestionnaire is connected' 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
|
before do
|
||||||
sign_in gestionnaire
|
sign_in gestionnaire
|
||||||
dossier.initiated!
|
dossier.en_construction!
|
||||||
|
|
||||||
post :create, params: {dossier_id: dossier_id, texte_commentaire: texte_commentaire}
|
post :create, params: {dossier_id: dossier_id, texte_commentaire: texte_commentaire}
|
||||||
dossier.reload
|
dossier.reload
|
||||||
|
|
|
@ -4,7 +4,7 @@ describe Backoffice::Dossiers::ProcedureController, type: :controller do
|
||||||
let(:gestionnaire) { create :gestionnaire }
|
let(:gestionnaire) { create :gestionnaire }
|
||||||
let(:procedure) { create :procedure, :published }
|
let(:procedure) { create :procedure, :published }
|
||||||
let(:archived) { false }
|
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
|
before do
|
||||||
create :assign_to, gestionnaire: gestionnaire, procedure: procedure
|
create :assign_to, gestionnaire: gestionnaire, procedure: procedure
|
||||||
|
|
|
@ -7,8 +7,8 @@ describe Backoffice::DossiersController, type: :controller do
|
||||||
let(:procedure) { create :procedure, :published }
|
let(:procedure) { create :procedure, :published }
|
||||||
let(:procedure2) { create :procedure, :published }
|
let(:procedure2) { 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(:dossier2) { create(:dossier, :with_entreprise, procedure: procedure2, state: :initiated) }
|
let(:dossier2) { create(:dossier, :with_entreprise, procedure: procedure2, state: :en_construction) }
|
||||||
let(:dossier_archived) { create(:dossier, :with_entreprise, archived: true) }
|
let(:dossier_archived) { create(:dossier, :with_entreprise, archived: true) }
|
||||||
|
|
||||||
let(:dossier_id) { dossier.id }
|
let(:dossier_id) { dossier.id }
|
||||||
|
@ -222,7 +222,7 @@ describe Backoffice::DossiersController, type: :controller do
|
||||||
|
|
||||||
describe 'POST #receive' do
|
describe 'POST #receive' do
|
||||||
before do
|
before do
|
||||||
dossier.initiated!
|
dossier.en_construction!
|
||||||
sign_in gestionnaire
|
sign_in gestionnaire
|
||||||
post :receive, params: { dossier_id: dossier_id }
|
post :receive, params: { dossier_id: dossier_id }
|
||||||
dossier.reload
|
dossier.reload
|
||||||
|
@ -360,11 +360,11 @@ describe Backoffice::DossiersController, type: :controller do
|
||||||
|
|
||||||
subject { post :reopen, params: {dossier_id: dossier_id} }
|
subject { post :reopen, params: {dossier_id: dossier_id} }
|
||||||
|
|
||||||
it 'change state to initiated' do
|
it 'change state to en_construction' do
|
||||||
subject
|
subject
|
||||||
|
|
||||||
dossier.reload
|
dossier.reload
|
||||||
expect(dossier.state).to eq('initiated')
|
expect(dossier.state).to eq('en_construction')
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to redirect_to backoffice_dossier_path(id: dossier_id) }
|
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
|
describe Backoffice::PrivateFormulairesController, type: :controller do
|
||||||
let(:gestionnaire) { create :gestionnaire }
|
let(:gestionnaire) { create :gestionnaire }
|
||||||
let(:dossier) { create :dossier, state: :initiated }
|
let(:dossier) { create :dossier, state: :en_construction }
|
||||||
let(:dossier_champs_first) { 'plop' }
|
let(:dossier_champs_first) { 'plop' }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe InvitesController, type: :controller do
|
describe InvitesController, type: :controller do
|
||||||
let(:dossier) { create(:dossier, :initiated) }
|
let(:dossier) { create(:dossier, :en_construction) }
|
||||||
let(:email) { 'plop@octo.com' }
|
let(:email) { 'plop@octo.com' }
|
||||||
|
|
||||||
describe '#POST create' do
|
describe '#POST create' do
|
||||||
|
|
|
@ -6,7 +6,7 @@ describe NewGestionnaire::AvisController, type: :controller do
|
||||||
let(:claimant) { create(:gestionnaire) }
|
let(:claimant) { create(:gestionnaire) }
|
||||||
let(:gestionnaire) { create(:gestionnaire) }
|
let(:gestionnaire) { create(:gestionnaire) }
|
||||||
let(:procedure) { create(:procedure, :published, gestionnaires: [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_without_answer) { Avis.create(dossier: dossier, claimant: claimant, gestionnaire: gestionnaire) }
|
||||||
let!(:avis_with_answer) { Avis.create(dossier: dossier, claimant: claimant, gestionnaire: gestionnaire, answer: 'yop') }
|
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(:gestionnaire) { create(:gestionnaire) }
|
||||||
let(:procedure) { create(:procedure, :published, gestionnaires: [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) }
|
before { sign_in(gestionnaire) }
|
||||||
|
|
||||||
describe '#attestation' do
|
describe '#attestation' do
|
||||||
context 'when a dossier has an attestation' do
|
context 'when a dossier has an attestation' do
|
||||||
let(:fake_pdf) { double(read: 'pdf content') }
|
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!(: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
|
it 'returns the attestation pdf' do
|
||||||
allow_any_instance_of(Attestation).to receive(:pdf).and_return(fake_pdf)
|
allow_any_instance_of(Attestation).to receive(:pdf).and_return(fake_pdf)
|
||||||
|
@ -79,7 +79,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
||||||
|
|
||||||
describe '#passer_en_instruction' do
|
describe '#passer_en_instruction' do
|
||||||
before do
|
before do
|
||||||
dossier.initiated!
|
dossier.en_construction!
|
||||||
sign_in gestionnaire
|
sign_in gestionnaire
|
||||||
post :passer_en_instruction, params: { procedure_id: procedure.id, dossier_id: dossier.id }
|
post :passer_en_instruction, params: { procedure_id: procedure.id, dossier_id: dossier.id }
|
||||||
dossier.reload
|
dossier.reload
|
||||||
|
@ -98,11 +98,11 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
||||||
|
|
||||||
subject { post :repasser_en_construction, params: { procedure_id: procedure.id, dossier_id: dossier.id} }
|
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
|
subject
|
||||||
|
|
||||||
dossier.reload
|
dossier.reload
|
||||||
expect(dossier.state).to eq('initiated')
|
expect(dossier.state).to eq('en_construction')
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to redirect_to dossier_path(procedure, dossier) }
|
it { is_expected.to redirect_to dossier_path(procedure, dossier) }
|
||||||
|
@ -344,7 +344,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:dossier) do
|
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
|
end
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
|
|
@ -134,15 +134,15 @@ describe NewGestionnaire::ProceduresController, type: :controller do
|
||||||
|
|
||||||
context "with not draft state on multiple procedures" do
|
context "with not draft state on multiple procedures" do
|
||||||
let(:procedure2) { create(:procedure, :published) }
|
let(:procedure2) { create(:procedure, :published) }
|
||||||
let(:state) { "initiated" }
|
let(:state) { "en_construction" }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
create(:dossier, procedure: procedure, state: "initiated")
|
create(:dossier, procedure: procedure, state: "en_construction")
|
||||||
create(:dossier, procedure: procedure, state: "received")
|
create(:dossier, procedure: procedure, state: "received")
|
||||||
create(:dossier, procedure: procedure, state: "without_continuation", archived: true)
|
create(:dossier, procedure: procedure, state: "without_continuation", archived: true)
|
||||||
|
|
||||||
gestionnaire.procedures << procedure2
|
gestionnaire.procedures << procedure2
|
||||||
create(:dossier, :followed, procedure: procedure2, state: "initiated")
|
create(:dossier, :followed, procedure: procedure2, state: "en_construction")
|
||||||
create(:dossier, procedure: procedure2, state: "closed")
|
create(:dossier, procedure: procedure2, state: "closed")
|
||||||
gestionnaire.followed_dossiers << create(:dossier, procedure: procedure2, state: "received")
|
gestionnaire.followed_dossiers << create(:dossier, procedure: procedure2, state: "received")
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe NewGestionnaire::RechercheController, type: :controller do
|
describe NewGestionnaire::RechercheController, type: :controller do
|
||||||
let(:dossier) { create(:dossier, :initiated) }
|
let(:dossier) { create(:dossier, :en_construction) }
|
||||||
let(:dossier2) { create(:dossier, :initiated, procedure: dossier.procedure) }
|
let(:dossier2) { create(:dossier, :en_construction, procedure: dossier.procedure) }
|
||||||
let(:gestionnaire) { create(:gestionnaire) }
|
let(:gestionnaire) { create(:gestionnaire) }
|
||||||
|
|
||||||
before { gestionnaire.procedures << dossier2.procedure }
|
before { gestionnaire.procedures << dossier2.procedure }
|
||||||
|
@ -26,7 +26,7 @@ describe NewGestionnaire::RechercheController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when gestionnaire do not own the dossier' do
|
context 'when gestionnaire do not own the dossier' do
|
||||||
let(:dossier3) { create(:dossier, :initiated) }
|
let(:dossier3) { create(:dossier, :en_construction) }
|
||||||
let(:query) { dossier3.id }
|
let(:query) { dossier3.id }
|
||||||
|
|
||||||
it { is_expected.to have_http_status(200) }
|
it { is_expected.to have_http_status(200) }
|
||||||
|
|
|
@ -142,19 +142,19 @@ describe StatsController, type: :controller do
|
||||||
procedure_2 = FactoryGirl.create(:procedure)
|
procedure_2 = FactoryGirl.create(:procedure)
|
||||||
dossier_p1_a = FactoryGirl.create(:dossier,
|
dossier_p1_a = FactoryGirl.create(:dossier,
|
||||||
:procedure => procedure_1,
|
:procedure => procedure_1,
|
||||||
:initiated_at => 2.months.ago.beginning_of_month,
|
:en_construction_at => 2.months.ago.beginning_of_month,
|
||||||
:processed_at => 2.months.ago.beginning_of_month + 3.days)
|
:processed_at => 2.months.ago.beginning_of_month + 3.days)
|
||||||
dossier_p1_b = FactoryGirl.create(:dossier,
|
dossier_p1_b = FactoryGirl.create(:dossier,
|
||||||
:procedure => procedure_1,
|
:procedure => procedure_1,
|
||||||
:initiated_at => 2.months.ago.beginning_of_month,
|
:en_construction_at => 2.months.ago.beginning_of_month,
|
||||||
:processed_at => 2.months.ago.beginning_of_month + 1.days)
|
:processed_at => 2.months.ago.beginning_of_month + 1.days)
|
||||||
dossier_p1_c = FactoryGirl.create(:dossier,
|
dossier_p1_c = FactoryGirl.create(:dossier,
|
||||||
:procedure => procedure_1,
|
:procedure => procedure_1,
|
||||||
:initiated_at => 1.months.ago.beginning_of_month,
|
:en_construction_at => 1.months.ago.beginning_of_month,
|
||||||
:processed_at => 1.months.ago.beginning_of_month + 5.days)
|
:processed_at => 1.months.ago.beginning_of_month + 5.days)
|
||||||
dossier_p2_a = FactoryGirl.create(:dossier,
|
dossier_p2_a = FactoryGirl.create(:dossier,
|
||||||
:procedure => procedure_2,
|
:procedure => procedure_2,
|
||||||
:initiated_at => 2.month.ago.beginning_of_month,
|
:en_construction_at => 2.month.ago.beginning_of_month,
|
||||||
:processed_at => 2.month.ago.beginning_of_month + 4.days)
|
:processed_at => 2.month.ago.beginning_of_month + 4.days)
|
||||||
|
|
||||||
# Write directly in the DB to avoid the before_validation hook
|
# Write directly in the DB to avoid the before_validation hook
|
||||||
|
@ -191,22 +191,22 @@ describe StatsController, type: :controller do
|
||||||
dossier_p1_a = FactoryGirl.create(:dossier,
|
dossier_p1_a = FactoryGirl.create(:dossier,
|
||||||
:procedure => procedure_1,
|
:procedure => procedure_1,
|
||||||
:created_at => 2.months.ago.beginning_of_month,
|
: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)
|
:processed_at => 2.months.ago.beginning_of_month + 1.day)
|
||||||
dossier_p1_b = FactoryGirl.create(:dossier,
|
dossier_p1_b = FactoryGirl.create(:dossier,
|
||||||
:procedure => procedure_1,
|
:procedure => procedure_1,
|
||||||
:created_at => 2.months.ago.beginning_of_month,
|
: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)
|
:processed_at => 2.months.ago.beginning_of_month + 1.day)
|
||||||
dossier_p1_c = FactoryGirl.create(:dossier,
|
dossier_p1_c = FactoryGirl.create(:dossier,
|
||||||
:procedure => procedure_1,
|
:procedure => procedure_1,
|
||||||
:created_at => 1.months.ago.beginning_of_month,
|
: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)
|
:processed_at => 1.months.ago.beginning_of_month + 1.day)
|
||||||
dossier_p2_a = FactoryGirl.create(:dossier,
|
dossier_p2_a = FactoryGirl.create(:dossier,
|
||||||
:procedure => procedure_2,
|
:procedure => procedure_2,
|
||||||
:created_at => 2.month.ago.beginning_of_month,
|
: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)
|
:processed_at => 2.month.ago.beginning_of_month + 1.day)
|
||||||
|
|
||||||
# Write directly in the DB to avoid the before_validation hook
|
# Write directly in the DB to avoid the before_validation hook
|
||||||
|
|
|
@ -67,7 +67,7 @@ shared_examples 'carte_controller_spec' do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'En train de modifier la localisation' do
|
context 'En train de modifier la localisation' do
|
||||||
let(:dossier) { create(:dossier, state: 'initiated') }
|
let(:dossier) { create(:dossier, state: 'en_construction') }
|
||||||
before do
|
before do
|
||||||
post :save, params: {dossier_id: dossier.id, json_latlngs: ''}
|
post :save, params: {dossier_id: dossier.id, json_latlngs: ''}
|
||||||
end
|
end
|
||||||
|
|
|
@ -125,7 +125,7 @@ shared_examples 'description_controller_spec' do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'etat du dossier est soumis' do
|
it 'etat du dossier est soumis' do
|
||||||
expect(dossier.state).to eq('initiated')
|
expect(dossier.state).to eq('en_construction')
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when user whould like save just a draft' do
|
context 'when user whould like save just a draft' do
|
||||||
|
@ -143,7 +143,7 @@ shared_examples 'description_controller_spec' do
|
||||||
|
|
||||||
context 'En train de manipuler un dossier non brouillon' do
|
context 'En train de manipuler un dossier non brouillon' do
|
||||||
before do
|
before do
|
||||||
dossier.initiated!
|
dossier.en_construction!
|
||||||
post :update, params: {dossier_id: dossier_id}
|
post :update, params: {dossier_id: dossier_id}
|
||||||
dossier.reload
|
dossier.reload
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,7 @@ describe Users::DescriptionController, type: :controller, vcr: {cassette_name: '
|
||||||
let(:owner_user) { create(:user) }
|
let(:owner_user) { create(:user) }
|
||||||
let(:invite_by_user) { create :user, email: 'invite@plop.com' }
|
let(:invite_by_user) { create :user, email: 'invite@plop.com' }
|
||||||
let(:archived_at) { nil }
|
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(: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) }
|
let(:dossier) { create(:dossier, procedure: procedure, user: owner_user, state: state) }
|
||||||
|
|
|
@ -435,7 +435,7 @@ describe Users::DossiersController, type: :controller do
|
||||||
describe 'DELETE #destroy' do
|
describe 'DELETE #destroy' do
|
||||||
let(:user) { create(:user) }
|
let(:user) { create(:user) }
|
||||||
let!(:dossier_draft) { create :dossier, state: "draft", user: user }
|
let!(:dossier_draft) { create :dossier, state: "draft", user: user }
|
||||||
let!(:dossier_not_draft) { create :dossier, state: "initiated", user: user }
|
let!(:dossier_not_draft) { create :dossier, state: "en_construction", user: user }
|
||||||
|
|
||||||
subject { delete :destroy, params: {id: dossier.id} }
|
subject { delete :destroy, params: {id: dossier.id} }
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe Users::RecapitulatifController, type: :controller do
|
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 }
|
let(:bad_dossier_id) { Dossier.count + 100000 }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
@ -43,10 +43,10 @@ describe Users::RecapitulatifController, type: :controller do
|
||||||
|
|
||||||
it 'dossier change his state for closed' do
|
it 'dossier change his state for closed' do
|
||||||
dossier.reload
|
dossier.reload
|
||||||
expect(dossier.state).to eq('initiated')
|
expect(dossier.state).to eq('en_construction')
|
||||||
end
|
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.')
|
expect(flash[:notice]).to include('Dossier soumis avec succès.')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -27,8 +27,8 @@ describe DossierDecorator do
|
||||||
expect(subject).to eq('Brouillon')
|
expect(subject).to eq('Brouillon')
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'initiated is initiate' do
|
it 'en_construction is En construction' do
|
||||||
dossier.initiated!
|
dossier.en_construction!
|
||||||
expect(subject).to eq('En construction')
|
expect(subject).to eq('En construction')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ describe DossierDecorator do
|
||||||
|
|
||||||
context "when the dossier is not in brouillon state" do
|
context "when the dossier is not in brouillon state" do
|
||||||
before do
|
before do
|
||||||
dossier.state = 'initiated'
|
dossier.state = 'en_construction'
|
||||||
dossier.save
|
dossier.save
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@ describe AdminProceduresShowFacades do
|
||||||
let!(:procedure) { create(:procedure) }
|
let!(:procedure) { create(:procedure) }
|
||||||
|
|
||||||
let!(:dossier_0) { create(:dossier, procedure: procedure, state: 'draft') }
|
let!(:dossier_0) { create(:dossier, procedure: procedure, state: 'draft') }
|
||||||
let!(:dossier_1) { create(:dossier, procedure: procedure, state: 'initiated') }
|
let!(:dossier_1) { create(:dossier, procedure: procedure, state: 'en_construction') }
|
||||||
let!(:dossier_2) { create(:dossier, procedure: procedure, state: 'initiated') }
|
let!(:dossier_2) { create(:dossier, procedure: procedure, state: 'en_construction') }
|
||||||
let!(:dossier_6) { create(:dossier, procedure: procedure, archived: true, state: 'initiated') }
|
let!(:dossier_6) { create(:dossier, procedure: procedure, archived: true, state: 'en_construction') }
|
||||||
|
|
||||||
subject { AdminProceduresShowFacades.new procedure }
|
subject { AdminProceduresShowFacades.new procedure }
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ describe AdminProceduresShowFacades do
|
||||||
|
|
||||||
it { expect(subject.size).to eq(1) }
|
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) }
|
it { expect(subject.first.total).to eq(1) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -72,10 +72,10 @@ FactoryGirl.define do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :initiated do
|
trait :en_construction do
|
||||||
after(:create) do |dossier, _evaluator|
|
after(:create) do |dossier, _evaluator|
|
||||||
dossier.state = 'initiated'
|
dossier.state = 'en_construction'
|
||||||
dossier.initiated_at = dossier.created_at + 1.minute
|
dossier.en_construction_at = dossier.created_at + 1.minute
|
||||||
dossier.save!
|
dossier.save!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -83,7 +83,7 @@ FactoryGirl.define do
|
||||||
trait :received do
|
trait :received do
|
||||||
after(:create) do |dossier, _evaluator|
|
after(:create) do |dossier, _evaluator|
|
||||||
dossier.state = 'received'
|
dossier.state = 'received'
|
||||||
dossier.initiated_at = dossier.created_at + 1.minute
|
dossier.en_construction_at = dossier.created_at + 1.minute
|
||||||
dossier.created_at = dossier.created_at + 2.minute
|
dossier.created_at = dossier.created_at + 2.minute
|
||||||
dossier.save!
|
dossier.save!
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
||||||
|
|
||||||
feature 'add commentaire on backoffice' do
|
feature 'add commentaire on backoffice' do
|
||||||
let(:procedure) { create(:procedure, :published) }
|
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(:dossier_id) { dossier.id }
|
||||||
let!(:commentaire) { create(:commentaire, dossier: dossier, email: 'toto@toto.com') }
|
let!(:commentaire) { create(:commentaire, dossier: dossier, email: 'toto@toto.com') }
|
||||||
let(:email_commentaire) { 'test@test.com' }
|
let(:email_commentaire) { 'test@test.com' }
|
||||||
|
|
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
||||||
feature 'backoffice: flux de commentaires' do
|
feature 'backoffice: flux de commentaires' do
|
||||||
let(:procedure) { create(:procedure, :published) }
|
let(:procedure) { create(:procedure, :published) }
|
||||||
let(:gestionnaire) { create(:gestionnaire) }
|
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(:dossier_id) { dossier.id }
|
||||||
|
|
||||||
let(:champ1) { create(:champ, dossier: dossier, type_de_champ: create(:type_de_champ_public, libelle: "subtitle1")) }
|
let(:champ1) { create(:champ, dossier: dossier, type_de_champ: create(:type_de_champ_public, libelle: "subtitle1")) }
|
||||||
|
|
|
@ -10,7 +10,7 @@ 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_1
|
||||||
create :assign_to, gestionnaire: gestionnaire, procedure: procedure_2
|
create :assign_to, gestionnaire: gestionnaire, procedure: procedure_2
|
||||||
30.times do
|
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
|
end
|
||||||
22.times do
|
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: 'received')
|
||||||
|
|
|
@ -6,7 +6,7 @@ feature 'usage of pref list dossier lateral panel', js: true do
|
||||||
let(:procedure) { create(:procedure, :published, administrateur: administrateur) }
|
let(:procedure) { create(:procedure, :published, administrateur: administrateur) }
|
||||||
|
|
||||||
before do
|
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
|
create :assign_to, procedure: procedure, gestionnaire: gestionnaire
|
||||||
|
|
||||||
login_as gestionnaire, scope: :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) }
|
let(:procedure) { create(:procedure, :published, :with_type_de_champ, administrateur: administrateur) }
|
||||||
|
|
||||||
before do
|
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
|
create :assign_to, procedure: procedure, gestionnaire: gestionnaire
|
||||||
|
|
||||||
login_as gestionnaire, scope: :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) { create(:procedure, :published, administrateur: administrateur) }
|
||||||
let(:procedure_individual) { create :procedure, :published, libelle: 'procedure individual', administrateur: administrateur, for_individual: true }
|
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) { create(:dossier, :with_entreprise, procedure: procedure, state: 'en_construction') }
|
||||||
let!(:dossier_individual) { create :dossier, procedure: procedure_individual, state: 'initiated' }
|
let!(:dossier_individual) { create :dossier, procedure: procedure_individual, state: 'en_construction' }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
create :assign_to, gestionnaire: gestionnaire, procedure: procedure
|
create :assign_to, gestionnaire: gestionnaire, procedure: procedure
|
||||||
|
@ -34,7 +34,7 @@ feature 'on backoffice page', js: true do
|
||||||
end
|
end
|
||||||
|
|
||||||
context "and goes to the page of a dossier he hasn't access to" do
|
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
|
before do
|
||||||
visit backoffice_dossier_path(unauthorized_dossier)
|
visit backoffice_dossier_path(unauthorized_dossier)
|
||||||
|
|
|
@ -39,8 +39,8 @@ feature 'search file on gestionnaire backoffice' do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when terms input does return result' do
|
context 'when terms input does return result' do
|
||||||
let!(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated') }
|
let!(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'en_construction') }
|
||||||
let!(:dossier_2) { create(:dossier, procedure: procedure, state: 'initiated') }
|
let!(:dossier_2) { create(:dossier, procedure: procedure, state: 'en_construction') }
|
||||||
|
|
||||||
let(:terms) { dossier.entreprise.raison_sociale }
|
let(:terms) { dossier.entreprise.raison_sociale }
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ feature 'The gestionnaire part' do
|
||||||
let!(:gestionnaire) { create(:gestionnaire, password: password) }
|
let!(:gestionnaire) { create(:gestionnaire, password: password) }
|
||||||
|
|
||||||
let!(:procedure) { create(:procedure, :published, gestionnaires: [gestionnaire]) }
|
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
|
scenario 'A gestionnaire can accept a dossier' do
|
||||||
log_in(gestionnaire.email, password)
|
log_in(gestionnaire.email, password)
|
||||||
|
|
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
||||||
feature 'As a User I want to edit a dossier I own' do
|
feature 'As a User I want to edit a dossier I own' do
|
||||||
let(:user) { create(:user) }
|
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(: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
|
before "Create dossier and visit root path" do
|
||||||
login_as user, scope: :user
|
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('etape_suivante').trigger('click')
|
||||||
page.find_by_id('suivant').trigger('click')
|
page.find_by_id('suivant').trigger('click')
|
||||||
50.times do
|
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
|
end
|
||||||
visit root_path
|
visit root_path
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
||||||
|
|
||||||
feature 'users: flux de commentaires' do
|
feature 'users: flux de commentaires' do
|
||||||
let(:user) { create(:user) }
|
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(:dossier_id) { dossier.id }
|
||||||
|
|
||||||
let(:champ1) { dossier.champs.first }
|
let(:champ1) { dossier.champs.first }
|
||||||
|
|
|
@ -2,10 +2,10 @@ require 'spec_helper'
|
||||||
|
|
||||||
describe 'user access to the list of his dossier' do
|
describe 'user access to the list of his dossier' do
|
||||||
let(:user) { create(:user) }
|
let(:user) { create(:user) }
|
||||||
let!(:last_updated_dossier) { 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: 'initiated') }
|
let!(:dossier1) { create(:dossier, :with_entreprise, user: user, state: 'en_construction') }
|
||||||
let!(:dossier2) { create(:dossier, :with_entreprise) }
|
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
|
before do
|
||||||
last_updated_dossier.update_column(:updated_at, "19/07/2052 15:35".to_time)
|
last_updated_dossier.update_column(:updated_at, "19/07/2052 15:35".to_time)
|
||||||
|
|
|
@ -3,10 +3,10 @@ require 'spec_helper'
|
||||||
feature 'on click on tabs button' do
|
feature 'on click on tabs button' do
|
||||||
let(:user) { create :user }
|
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
|
before do
|
||||||
create(:dossier, :with_entreprise, user: user, state: 'initiated')
|
create(:dossier, :with_entreprise, user: user, state: 'en_construction')
|
||||||
create(:dossier, :with_entreprise, user: user, state: 'received')
|
create(:dossier, :with_entreprise, user: user, state: 'received')
|
||||||
create(:dossier, :with_entreprise, user: user, state: 'closed')
|
create(:dossier, :with_entreprise, user: user, state: 'closed')
|
||||||
create(:dossier, :with_entreprise, user: user, state: 'refused')
|
create(:dossier, :with_entreprise, user: user, state: 'refused')
|
||||||
|
|
|
@ -19,14 +19,14 @@ RSpec.describe AutoArchiveProcedureJob, type: :job do
|
||||||
|
|
||||||
context "when procedures have auto_archive_on set on yesterday or today" do
|
context "when procedures have auto_archive_on set on yesterday or today" do
|
||||||
let!(:dossier1) { create(:dossier, procedure: procedure_hier, state: 'draft', archived: false)}
|
let!(:dossier1) { create(:dossier, procedure: procedure_hier, state: 'draft', archived: false)}
|
||||||
let!(:dossier2) { create(:dossier, procedure: procedure_hier, state: 'initiated', archived: false)}
|
let!(:dossier2) { create(:dossier, procedure: procedure_hier, state: 'en_construction', archived: false)}
|
||||||
let!(:dossier3) { create(:dossier, procedure: procedure_hier, state: 'initiated', archived: false)}
|
let!(:dossier3) { create(:dossier, procedure: procedure_hier, state: 'en_construction', archived: false)}
|
||||||
let!(:dossier4) { create(:dossier, procedure: procedure_hier, state: 'initiated', archived: false)}
|
let!(:dossier4) { create(:dossier, procedure: procedure_hier, state: 'en_construction', archived: false)}
|
||||||
let!(:dossier5) { create(:dossier, procedure: procedure_hier, state: 'received', 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!(:dossier6) { create(:dossier, procedure: procedure_hier, state: 'closed', archived: false)}
|
||||||
let!(:dossier7) { create(:dossier, procedure: procedure_hier, state: 'refused', 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!(:dossier8) { create(:dossier, procedure: procedure_hier, state: 'without_continuation', archived: false)}
|
||||||
let!(:dossier9) { create(:dossier, procedure: procedure_aujourdhui, state: 'initiated', archived: false)}
|
let!(:dossier9) { create(:dossier, procedure: procedure_aujourdhui, state: 'en_construction', archived: false)}
|
||||||
|
|
||||||
before do
|
before do
|
||||||
subject
|
subject
|
||||||
|
|
|
@ -10,8 +10,8 @@ RSpec.describe AutoReceiveDossiersForProcedureJob, type: :job do
|
||||||
subject { AutoReceiveDossiersForProcedureJob.new.perform(procedure_id, 'received') }
|
subject { AutoReceiveDossiersForProcedureJob.new.perform(procedure_id, 'received') }
|
||||||
|
|
||||||
context "with some dossiers" do
|
context "with some dossiers" do
|
||||||
let(:nouveau_dossier1) { create(:dossier, :initiated) }
|
let(:nouveau_dossier1) { create(:dossier, :en_construction) }
|
||||||
let(:nouveau_dossier2) { create(:dossier, :initiated, procedure: nouveau_dossier1.procedure) }
|
let(:nouveau_dossier2) { create(:dossier, :en_construction, procedure: nouveau_dossier1.procedure) }
|
||||||
let(:dossier_recu) { create(:dossier, :received, procedure: nouveau_dossier2.procedure) }
|
let(:dossier_recu) { create(:dossier, :received, procedure: nouveau_dossier2.procedure) }
|
||||||
let(:dossier_draft) { create(:dossier, procedure: dossier_recu.procedure) }
|
let(:dossier_draft) { create(:dossier, procedure: dossier_recu.procedure) }
|
||||||
let(:procedure_id) { dossier_draft.procedure_id }
|
let(:procedure_id) { dossier_draft.procedure_id }
|
||||||
|
|
|
@ -112,7 +112,7 @@ describe Dossier do
|
||||||
|
|
||||||
it 'does not create default champs' do
|
it 'does not create default champs' do
|
||||||
expect(subject).not_to receive(:build_default_champs)
|
expect(subject).not_to receive(:build_default_champs)
|
||||||
subject.update_attributes(state: 'initiated')
|
subject.update_attributes(state: 'en_construction')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -157,14 +157,14 @@ describe Dossier do
|
||||||
context 'when he initiate a dossier' do
|
context 'when he initiate a dossier' do
|
||||||
let(:action) { 'initiate' }
|
let(:action) { 'initiate' }
|
||||||
|
|
||||||
it { is_expected.to eq('initiated') }
|
it { is_expected.to eq('en_construction') }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when dossier is at state initiated' do
|
context 'when dossier is at state en_construction' do
|
||||||
before do
|
before do
|
||||||
dossier.initiated!
|
dossier.en_construction!
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when user is connect' do
|
context 'when user is connect' do
|
||||||
|
@ -173,13 +173,13 @@ describe Dossier do
|
||||||
context 'when is update dossier informations' do
|
context 'when is update dossier informations' do
|
||||||
let(:action) { 'update' }
|
let(:action) { 'update' }
|
||||||
|
|
||||||
it { is_expected.to eq('initiated') }
|
it { is_expected.to eq('en_construction') }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when is post a comment' do
|
context 'when is post a comment' do
|
||||||
let(:action) { 'comment' }
|
let(:action) { 'comment' }
|
||||||
|
|
||||||
it { is_expected.to eq('initiated') }
|
it { is_expected.to eq('en_construction') }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -189,13 +189,13 @@ describe Dossier do
|
||||||
context 'when is post a comment' do
|
context 'when is post a comment' do
|
||||||
let(:action) { 'comment' }
|
let(:action) { 'comment' }
|
||||||
|
|
||||||
it { is_expected.to eq('initiated') }
|
it { is_expected.to eq('en_construction') }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when is follow' do
|
context 'when is follow' do
|
||||||
let(:action) { 'follow' }
|
let(:action) { 'follow' }
|
||||||
|
|
||||||
it { is_expected.to eq 'initiated' }
|
it { is_expected.to eq 'en_construction' }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -394,7 +394,7 @@ describe Dossier do
|
||||||
let(:date1) { 1.day.ago }
|
let(:date1) { 1.day.ago }
|
||||||
let(:date2) { 1.hour.ago }
|
let(:date2) { 1.hour.ago }
|
||||||
let(:date3) { 1.minute.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, received_at: date2, processed_at: date3, motivation: "Motivation") }
|
||||||
let!(:follow) { create(:follow, gestionnaire: gestionnaire, dossier: dossier) }
|
let!(:follow) { create(:follow, gestionnaire: gestionnaire, dossier: dossier) }
|
||||||
|
|
||||||
describe '#export_headers' do
|
describe '#export_headers' do
|
||||||
|
@ -460,7 +460,7 @@ describe Dossier do
|
||||||
dossier.user.email,
|
dossier.user.email,
|
||||||
"false",
|
"false",
|
||||||
"draft",
|
"draft",
|
||||||
dossier.initiated_at,
|
dossier.en_construction_at,
|
||||||
dossier.received_at,
|
dossier.received_at,
|
||||||
dossier.processed_at,
|
dossier.processed_at,
|
||||||
"Motivation",
|
"Motivation",
|
||||||
|
@ -615,15 +615,15 @@ describe Dossier do
|
||||||
describe "#text_summary" do
|
describe "#text_summary" do
|
||||||
let(:procedure) { create(:procedure, libelle: "Procédure", organisation: "Organisme") }
|
let(:procedure) { create(:procedure, libelle: "Procédure", organisation: "Organisme") }
|
||||||
|
|
||||||
context 'when the dossier has been initiated' do
|
context 'when the dossier has been en_construction' do
|
||||||
let(:dossier) { create :dossier, procedure: procedure, state: 'initiated', initiated_at: "31/12/2010".to_date }
|
let(:dossier) { create :dossier, procedure: procedure, state: 'en_construction', en_construction_at: "31/12/2010".to_date }
|
||||||
|
|
||||||
subject { dossier.text_summary }
|
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") }
|
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
|
end
|
||||||
|
|
||||||
context 'when the dossier has not been initiated' do
|
context 'when the dossier has not been en_construction' do
|
||||||
let(:dossier) { create :dossier, procedure: procedure, state: 'draft' }
|
let(:dossier) { create :dossier, procedure: procedure, state: 'draft' }
|
||||||
|
|
||||||
subject { dossier.text_summary }
|
subject { dossier.text_summary }
|
||||||
|
@ -634,7 +634,7 @@ describe Dossier do
|
||||||
|
|
||||||
describe '#avis_for' do
|
describe '#avis_for' do
|
||||||
let!(:procedure) { create(:procedure, :published) }
|
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!(:gestionnaire) { create(:gestionnaire, procedures: [procedure]) }
|
||||||
let!(:expert_1) { create(:gestionnaire) }
|
let!(:expert_1) { create(:gestionnaire) }
|
||||||
|
@ -691,26 +691,26 @@ describe Dossier do
|
||||||
Timecop.freeze(beginning_of_day)
|
Timecop.freeze(beginning_of_day)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when dossier is initiated' do
|
context 'when dossier is en_construction' do
|
||||||
before do
|
before do
|
||||||
dossier.initiated!
|
dossier.en_construction!
|
||||||
dossier.reload
|
dossier.reload
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(dossier.state).to eq('initiated') }
|
it { expect(dossier.state).to eq('en_construction') }
|
||||||
it { expect(dossier.initiated_at).to eq(beginning_of_day) }
|
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
|
Timecop.return
|
||||||
dossier.received!
|
dossier.received!
|
||||||
dossier.initiated!
|
dossier.en_construction!
|
||||||
|
|
||||||
expect(dossier.initiated_at).to eq(beginning_of_day)
|
expect(dossier.en_construction_at).to eq(beginning_of_day)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when dossier is received' do
|
context 'when dossier is received' do
|
||||||
let(:state) { 'initiated' }
|
let(:state) { 'en_construction' }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
dossier.received!
|
dossier.received!
|
||||||
|
@ -720,9 +720,9 @@ describe Dossier do
|
||||||
it { expect(dossier.state).to eq('received') }
|
it { expect(dossier.state).to eq('received') }
|
||||||
it { expect(dossier.received_at).to eq(beginning_of_day) }
|
it { expect(dossier.received_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 received_at date if dossier is set to en_construction again' do
|
||||||
Timecop.return
|
Timecop.return
|
||||||
dossier.initiated!
|
dossier.en_construction!
|
||||||
dossier.received!
|
dossier.received!
|
||||||
|
|
||||||
expect(dossier.received_at).to eq(beginning_of_day)
|
expect(dossier.received_at).to eq(beginning_of_day)
|
||||||
|
@ -761,9 +761,9 @@ describe Dossier do
|
||||||
describe '.downloadable_sorted' do
|
describe '.downloadable_sorted' do
|
||||||
let(:procedure) { create(:procedure) }
|
let(:procedure) { create(:procedure) }
|
||||||
let!(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: :draft) }
|
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!(:dossier2) { create(:dossier, :with_entreprise, procedure: procedure, state: :en_construction, en_construction_at: DateTime.parse('03/01/2010')) }
|
||||||
let!(:dossier3) { create(:dossier, :with_entreprise, procedure: procedure, state: :received, initiated_at: DateTime.parse('01/01/2010')) }
|
let!(:dossier3) { create(:dossier, :with_entreprise, procedure: procedure, state: :received, en_construction_at: DateTime.parse('01/01/2010')) }
|
||||||
let!(:dossier4) { create(:dossier, :with_entreprise, procedure: procedure, state: :received, archived: true, initiated_at: DateTime.parse('02/01/2010')) }
|
let!(:dossier4) { create(:dossier, :with_entreprise, procedure: procedure, state: :received, archived: true, en_construction_at: DateTime.parse('02/01/2010')) }
|
||||||
|
|
||||||
subject { procedure.dossiers.downloadable_sorted }
|
subject { procedure.dossiers.downloadable_sorted }
|
||||||
|
|
||||||
|
@ -772,7 +772,7 @@ describe Dossier do
|
||||||
|
|
||||||
describe "#send_dossier_received" do
|
describe "#send_dossier_received" do
|
||||||
let(:procedure) { create(:procedure) }
|
let(:procedure) { create(:procedure) }
|
||||||
let(:dossier) { create(:dossier, procedure: procedure, state: :initiated) }
|
let(:dossier) { create(:dossier, procedure: procedure, state: :en_construction) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
allow(NotificationMailer).to receive(:send_dossier_received).and_return(double(deliver_later: nil))
|
allow(NotificationMailer).to receive(:send_dossier_received).and_return(double(deliver_later: nil))
|
||||||
|
@ -805,7 +805,7 @@ describe Dossier do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not send an email when the dossier is created with a non draft state" do
|
it "does not send an email when the dossier is created with a non 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: "en_construction", user: user) }.not_to change(ActionMailer::Base.deliveries, :size)
|
||||||
expect { Dossier.create(procedure: procedure, state: "received", user: user) }.not_to change(ActionMailer::Base.deliveries, :size)
|
expect { Dossier.create(procedure: procedure, state: "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: "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: "refused", user: user) }.not_to change(ActionMailer::Base.deliveries, :size)
|
||||||
|
|
|
@ -169,7 +169,7 @@ describe Gestionnaire, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when gestionnaire follow a dossier with a notification into the procedure past in params' do
|
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
|
before do
|
||||||
create :follow, gestionnaire: gestionnaire, dossier: dossier
|
create :follow, gestionnaire: gestionnaire, dossier: dossier
|
||||||
|
@ -405,7 +405,7 @@ describe Gestionnaire, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#notifications_for_dossier' do
|
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 }
|
let(:gestionnaire) { dossier.follows.first.gestionnaire }
|
||||||
|
|
||||||
subject { gestionnaire.notifications_for_dossier(dossier) }
|
subject { gestionnaire.notifications_for_dossier(dossier) }
|
||||||
|
@ -454,12 +454,12 @@ describe Gestionnaire, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#notification_for_procedure' do
|
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(:gestionnaire) { dossier.follows.first.gestionnaire }
|
||||||
let(:procedure) { dossier.procedure }
|
let(:procedure) { dossier.procedure }
|
||||||
let!(:gestionnaire_2) { create(:gestionnaire, procedures: [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 }
|
let!(:gestionnaire_on_procedure_2) { dossier_on_procedure_2.follows.first.gestionnaire }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
@ -535,7 +535,7 @@ describe Gestionnaire, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#notifications_per_procedure' do
|
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(:gestionnaire) { dossier.follows.first.gestionnaire }
|
||||||
let(:procedure) { dossier.procedure }
|
let(:procedure) { dossier.procedure }
|
||||||
|
|
||||||
|
@ -549,7 +549,7 @@ describe Gestionnaire, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#mark_tab_as_seen' do
|
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(:gestionnaire) { dossier.follows.first.gestionnaire }
|
||||||
let(:freeze_date) { DateTime.parse('12/12/2012') }
|
let(:freeze_date) { DateTime.parse('12/12/2012') }
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ describe ProcedureOverview, type: :model do
|
||||||
|
|
||||||
describe 'dossiers_en_construction_count' do
|
describe 'dossiers_en_construction_count' do
|
||||||
let!(:dossier_en_construction) 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
|
end
|
||||||
|
|
||||||
it { expect(procedure_overview.dossiers_en_construction_count).to eq(1) }
|
it { expect(procedure_overview.dossiers_en_construction_count).to eq(1) }
|
||||||
|
|
|
@ -307,9 +307,9 @@ describe Procedure do
|
||||||
let(:procedure) { create :procedure }
|
let(:procedure) { create :procedure }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
create :dossier, procedure: procedure, state: :initiated
|
create :dossier, procedure: procedure, state: :en_construction
|
||||||
create :dossier, procedure: procedure, state: :draft
|
create :dossier, procedure: procedure, state: :draft
|
||||||
create :dossier, procedure: procedure, state: :initiated
|
create :dossier, procedure: procedure, state: :en_construction
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { procedure.total_dossier }
|
subject { procedure.total_dossier }
|
||||||
|
@ -331,7 +331,7 @@ describe Procedure do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when there are some dossiers' do
|
context 'when there are some dossiers' do
|
||||||
let!(:dossier){ create(:dossier, procedure: procedure, state: 'initiated') }
|
let!(:dossier){ create(:dossier, procedure: procedure, state: 'en_construction') }
|
||||||
let!(:dossier2){ create(:dossier, procedure: procedure, state: 'closed') }
|
let!(:dossier2){ create(:dossier, procedure: procedure, state: 'closed') }
|
||||||
|
|
||||||
it { expect(subject[:data].size).to eq(2) }
|
it { expect(subject[:data].size).to eq(2) }
|
||||||
|
|
|
@ -23,10 +23,10 @@ describe Search do
|
||||||
let(:procedure_2) { create(:procedure, :published, administrateur: administrateur_2) }
|
let(:procedure_2) { create(:procedure, :published, administrateur: administrateur_2) }
|
||||||
|
|
||||||
let!(:dossier_0) { create(:dossier, state: 'draft', procedure: procedure_1, user: create(:user, email: 'brouillon@clap.fr')) }
|
let!(:dossier_0) { create(:dossier, state: '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_1) { create(:dossier, state: 'en_construction', 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_2) { create(:dossier, state: 'en_construction', 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_3) { create(:dossier, state: 'en_construction', 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_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_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') }
|
let!(:etablissement_2) { create(:etablissement, entreprise: create(:entreprise, raison_sociale: 'Plop octo', dossier: dossier_2), dossier: dossier_2, siret: '41816602300012') }
|
||||||
|
|
12
spec/serializers/dossier_serializer_spec.rb
Normal file
12
spec/serializers/dossier_serializer_spec.rb
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
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
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,6 +1,17 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe DossierTableExportSerializer do
|
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
|
||||||
|
end
|
||||||
|
|
||||||
describe '#emails_accompagnateurs' do
|
describe '#emails_accompagnateurs' do
|
||||||
let(:gestionnaire){ create(:gestionnaire) }
|
let(:gestionnaire){ create(:gestionnaire) }
|
||||||
let(:gestionnaire2) { 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
|
|
@ -346,15 +346,15 @@ describe DossiersListGestionnaireService do
|
||||||
describe 'state filter methods' do
|
describe 'state filter methods' do
|
||||||
let!(:procedure) { create :procedure }
|
let!(:procedure) { create :procedure }
|
||||||
let!(:dossier) { create(:dossier, procedure: procedure, state: 'draft') }
|
let!(:dossier) { create(:dossier, procedure: procedure, state: 'draft') }
|
||||||
let!(:dossier2) { create(:dossier, procedure: procedure, state: 'initiated') } #nouveaux
|
let!(:dossier2) { create(:dossier, procedure: procedure, state: 'en_construction') } #nouveaux
|
||||||
let!(:dossier3) { create(:dossier, procedure: procedure, state: 'initiated') } #nouveaux
|
let!(:dossier3) { create(:dossier, procedure: procedure, state: 'en_construction') } #nouveaux
|
||||||
let!(:dossier6) { create(:dossier, procedure: procedure, state: 'received') } #a_instruire
|
let!(:dossier6) { create(:dossier, procedure: procedure, state: 'received') } #a_instruire
|
||||||
let!(:dossier7) { 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!(:dossier8) { create(:dossier, procedure: procedure, state: 'closed') } #termine
|
||||||
let!(:dossier9) { create(:dossier, procedure: procedure, state: 'refused') } #termine
|
let!(:dossier9) { create(:dossier, procedure: procedure, state: 'refused') } #termine
|
||||||
let!(:dossier10) { create(:dossier, procedure: procedure, state: 'without_continuation') } #termine
|
let!(:dossier10) { create(:dossier, procedure: procedure, state: 'without_continuation') } #termine
|
||||||
let!(:dossier11) { create(:dossier, procedure: procedure, state: 'closed') } #termine
|
let!(:dossier11) { create(:dossier, procedure: procedure, state: 'closed') } #termine
|
||||||
let!(:dossier12) { create(:dossier, procedure: procedure, state: 'initiated', archived: true) } #a_traiter #archived
|
let!(:dossier12) { create(:dossier, procedure: procedure, state: 'en_construction', archived: true) } #a_traiter #archived
|
||||||
let!(:dossier14) { create(:dossier, procedure: procedure, state: 'closed', archived: true) } #termine #archived
|
let!(:dossier14) { create(:dossier, procedure: procedure, state: 'closed', archived: true) } #termine #archived
|
||||||
|
|
||||||
describe '#termine' do
|
describe '#termine' do
|
||||||
|
|
|
@ -18,8 +18,8 @@ describe UserRoutesAuthorizationService do
|
||||||
it { is_expected.to be_truthy }
|
it { is_expected.to be_truthy }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'initiated' do
|
describe 'en_construction' do
|
||||||
let(:state) { 'initiated' }
|
let(:state) { 'en_construction' }
|
||||||
it { is_expected.to be_falsey }
|
it { is_expected.to be_falsey }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -38,8 +38,8 @@ describe UserRoutesAuthorizationService do
|
||||||
it { is_expected.to be_falsey }
|
it { is_expected.to be_falsey }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'initiated' do
|
describe 'en_construction' do
|
||||||
let(:state) { 'initiated' }
|
let(:state) { 'en_construction' }
|
||||||
it { is_expected.to be_falsey }
|
it { is_expected.to be_falsey }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -57,8 +57,8 @@ describe UserRoutesAuthorizationService do
|
||||||
it { is_expected.to be_truthy }
|
it { is_expected.to be_truthy }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'initiated' do
|
describe 'en_construction' do
|
||||||
let(:state) { 'initiated' }
|
let(:state) { 'en_construction' }
|
||||||
it { is_expected.to be_truthy }
|
it { is_expected.to be_truthy }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -77,8 +77,8 @@ describe UserRoutesAuthorizationService do
|
||||||
it { is_expected.to be_truthy }
|
it { is_expected.to be_truthy }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'initiated' do
|
describe 'en_construction' do
|
||||||
let(:state) { 'initiated' }
|
let(:state) { 'en_construction' }
|
||||||
it { is_expected.to be_truthy }
|
it { is_expected.to be_truthy }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -96,8 +96,8 @@ describe UserRoutesAuthorizationService do
|
||||||
it { is_expected.to be_falsey }
|
it { is_expected.to be_falsey }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'initiated' do
|
describe 'en_construction' do
|
||||||
let(:state) { 'initiated' }
|
let(:state) { 'en_construction' }
|
||||||
it { is_expected.to be_truthy }
|
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
|
context 'si la page précédente est recapitularif' do
|
||||||
before do
|
before do
|
||||||
dossier.initiated!
|
dossier.en_construction!
|
||||||
dossier.reload
|
dossier.reload
|
||||||
render
|
render
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,7 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
|
||||||
|
|
||||||
let!(:procedure) { create(:procedure, :published, administrateur: administrateur) }
|
let!(:procedure) { create(:procedure, :published, administrateur: administrateur) }
|
||||||
|
|
||||||
let!(:decorate_dossier_initiated) { create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated').decorate }
|
let!(:decorate_dossier_en_construction) { create(:dossier, :with_entreprise, procedure: procedure, state: 'en_construction').decorate }
|
||||||
let!(:decorate_dossier_received) { create(:dossier, :with_entreprise, procedure: procedure, state: 'received').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_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_refused) { create(:dossier, :with_entreprise, procedure: procedure, state: 'refused').decorate }
|
||||||
|
|
|
@ -28,8 +28,8 @@ describe 'layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.htm
|
||||||
it { expect(rendered).to have_link('Passer en instruction') }
|
it { expect(rendered).to have_link('Passer en instruction') }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when dossier have state initiated' do
|
context 'when dossier have state en_construction' do
|
||||||
let(:state) { 'initiated' }
|
let(:state) { 'en_construction' }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
render
|
render
|
||||||
|
|
|
@ -11,8 +11,8 @@ describe 'layouts/left_panels/_left_panel_users_recapitulatifcontroller_show.htm
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'buttons to change dossier state' do
|
context 'buttons to change dossier state' do
|
||||||
context 'when dossier state is initiated' do
|
context 'when dossier state is en_construction' do
|
||||||
let(:state) { 'initiated' }
|
let(:state) { 'en_construction' }
|
||||||
before do
|
before do
|
||||||
render
|
render
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,7 @@ describe 'new_gestionnaire/dossiers/show.html.haml', type: :view do
|
||||||
let(:current_gestionnaire) { create(:gestionnaire) }
|
let(:current_gestionnaire) { create(:gestionnaire) }
|
||||||
let(:individual) { nil }
|
let(:individual) { nil }
|
||||||
let(:entreprise) { 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
|
before do
|
||||||
assign(:dossier, dossier)
|
assign(:dossier, dossier)
|
||||||
|
|
|
@ -14,7 +14,7 @@ describe 'new_gestionnaire/procedures/_download_dossiers.html.haml', type: :view
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when procedure has at least 1 dossier en construction" do
|
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") }
|
it { is_expected.to include("Télécharger tous les dossiers") }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -38,7 +38,7 @@ describe 'users/carte/show.html.haml', type: :view do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'si la page précédente est recapitularif' do
|
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
|
it 'le bouton "Etape suivante" n\'est pas présent' do
|
||||||
expect(rendered).to_not have_selector('#etape_suivante')
|
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
|
context 'si la page précédente est recapitularif' do
|
||||||
before do
|
before do
|
||||||
dossier.initiated!
|
dossier.en_construction!
|
||||||
dossier.reload
|
dossier.reload
|
||||||
render
|
render
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,12 +3,12 @@ require 'spec_helper'
|
||||||
describe 'users/dossiers/index.html.haml', type: :view do
|
describe 'users/dossiers/index.html.haml', type: :view do
|
||||||
let(:user) { create(:user) }
|
let(:user) { create(:user) }
|
||||||
|
|
||||||
let!(:decorate_dossier_initiated) { create(:dossier, :with_entreprise, user: user, state: 'initiated').decorate }
|
let!(:decorate_dossier_en_construction) { create(:dossier, :with_entreprise, user: user, state: 'en_construction').decorate }
|
||||||
let!(:decorate_dossier_received) { create(:dossier, :with_entreprise, user: user, state: 'received').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_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_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_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_invite) { create(:dossier, :with_entreprise, user: create(:user), state: 'en_construction').decorate }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
create :invite, dossier: decorate_dossier_invite, user: user
|
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' }
|
let(:liste) { 'a_traiter' }
|
||||||
|
|
||||||
it_behaves_like 'check_tab_content' do
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -59,8 +59,8 @@ describe 'users/recapitulatif/show.html.haml', type: :view do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when dossier state is initiated' do
|
context 'when dossier state is en_construction' do
|
||||||
let(:state) { 'initiated' }
|
let(:state) { 'en_construction' }
|
||||||
before do
|
before do
|
||||||
render
|
render
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue