Merge branch 'staging'

This commit is contained in:
Mathieu Magnin 2017-03-07 11:11:47 +01:00
commit 8ded471f61
94 changed files with 724 additions and 994 deletions

View file

@ -64,7 +64,6 @@ gem 'fog'
gem 'fog-openstack' gem 'fog-openstack'
gem 'pg' gem 'pg'
gem 'scenic'
gem 'rgeo-geojson' gem 'rgeo-geojson'
gem 'leaflet-rails' gem 'leaflet-rails'
@ -115,6 +114,7 @@ group :test do
gem 'guard-livereload', '~> 2.4', require: false gem 'guard-livereload', '~> 2.4', require: false
gem 'vcr' gem 'vcr'
gem 'rails-controller-testing' gem 'rails-controller-testing'
gem 'sqlite3'
end end
group :development do group :development do
@ -122,6 +122,7 @@ group :development do
gem 'web-console' gem 'web-console'
gem 'rack-handlers' gem 'rack-handlers'
gem 'xray-rails' gem 'xray-rails'
gem 'scenic'
end end
group :development, :test do group :development, :test do
@ -152,5 +153,6 @@ group :development, :test do
end end
group :production, :staging do group :production, :staging do
gem 'scenic'
gem 'sentry-raven' gem 'sentry-raven'
end end

View file

@ -564,6 +564,7 @@ GEM
actionpack (>= 4.0) actionpack (>= 4.0)
activesupport (>= 4.0) activesupport (>= 4.0)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
sqlite3 (1.3.13)
swd (1.0.1) swd (1.0.1)
activesupport (>= 3) activesupport (>= 3)
attr_required (>= 0.0.5) attr_required (>= 0.0.5)
@ -695,6 +696,7 @@ DEPENDENCIES
simplecov simplecov
smart_listing smart_listing
spreadsheet_architect spreadsheet_architect
sqlite3
therubyracer therubyracer
timecop timecop
turbolinks (~> 2.5) turbolinks (~> 2.5)
@ -708,4 +710,4 @@ DEPENDENCIES
xray-rails xray-rails
BUNDLED WITH BUNDLED WITH
1.13.7 1.14.4

View file

@ -2,8 +2,6 @@
font-family: Arial; font-family: Arial;
.show-block { .show-block {
width: 840px;
min-width: 840px;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
box-shadow: 0 0 1px 0 rgba(0, 0, 0, 0.5); box-shadow: 0 0 1px 0 rgba(0, 0, 0, 0.5);

View file

@ -34,7 +34,7 @@
} }
} }
#navbar-body { #navbar-body {
height: 60px; min-height: 60px;
background-color: #FFFFFF; background-color: #FFFFFF;
box-shadow: 0 1px 2px 0 rgba(50,50,50,0.5); box-shadow: 0 1px 2px 0 rgba(50,50,50,0.5);
padding-left: 50px; padding-left: 50px;
@ -43,9 +43,10 @@
font-size: 18px; font-size: 18px;
font-weight: bold; font-weight: bold;
line-height: 58px; line-height: 58px;
height: 58px; min-height: 58px;
color: #000000; color: #000000;
overflow: hidden; overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.options { .options {
@ -56,7 +57,7 @@
color: #666666; color: #666666;
padding: 8px; padding: 8px;
border-right: 1px solid #C8C6C8; border-right: 1px solid #C8C6C8;
height: 60px; min-height: 60px;
.dropdown-toggle { .dropdown-toggle {
cursor: pointer; cursor: pointer;
} }
@ -84,12 +85,8 @@
#sign_in{ #sign_in{
margin-top: 7px; margin-top: 7px;
.btn { .btn {
color: #003C92;
float: right; float: right;
margin-right: 1.3em; margin-right: 15px;
}
.btn:hover {
color: #668ABD;
} }
} }

View file

@ -181,7 +181,8 @@ class Admin::ProceduresController < AdminController
def path_list def path_list
render json: ProcedurePath render json: ProcedurePath
.joins(', procedures') .joins(', procedures')
.where("procedures.id = procedure_paths.procedure_id AND procedures.archived != true") .where("procedures.id = procedure_paths.procedure_id")
.where("procedures.archived" => false)
.where("path LIKE '%#{params[:request]}%'") .where("path LIKE '%#{params[:request]}%'")
.pluck(:path, :administrateur_id) .pluck(:path, :administrateur_id)
.inject([]) { .inject([]) {

View file

@ -85,21 +85,10 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
default_sort: dossiers_list_facade.service.default_sort default_sort: dossiers_list_facade.service.default_sort
end end
def valid
create_dossier_facade params[:dossier_id]
@facade.dossier.next_step! 'gestionnaire', 'valid'
flash.notice = 'Dossier confirmé avec succès.'
NotificationMailer.dossier_validated(@facade.dossier).deliver_now!
redirect_to backoffice_dossier_path(id: @facade.dossier.id)
end
def receive def receive
create_dossier_facade params[:dossier_id] create_dossier_facade params[:dossier_id]
@facade.dossier.next_step! 'gestionnaire', 'receive' @facade.dossier.received!
flash.notice = 'Dossier considéré comme reçu.' flash.notice = 'Dossier considéré comme reçu.'
NotificationMailer.dossier_received(@facade.dossier).deliver_now! NotificationMailer.dossier_received(@facade.dossier).deliver_now!
@ -162,7 +151,7 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
end end
def archive def archive
facade = create_dossier_facade params[:dossier_id] facade = create_dossier_facade params[:id]
unless facade.dossier.archived unless facade.dossier.archived
facade.dossier.update(archived: true) facade.dossier.update(archived: true)
flash.notice = 'Dossier archivé' flash.notice = 'Dossier archivé'
@ -170,6 +159,25 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
redirect_to backoffice_dossiers_path redirect_to backoffice_dossiers_path
end end
def unarchive
@dossier = Dossier.find(params[:id])
if @dossier.archived
@dossier.update(archived: false)
flash.notice = 'Dossier désarchivé'
end
redirect_to backoffice_dossier_path(@dossier)
end
def reopen
create_dossier_facade params[:dossier_id]
@facade.dossier.replied!
flash.notice = 'Dossier réouvert.'
redirect_to backoffice_dossiers_path
end
private private
def create_dossier_facade dossier_id def create_dossier_facade dossier_id

View file

@ -29,36 +29,31 @@ class Backoffice::DossiersListController < ApplicationController
def smartlisting_dossier dossiers_list=nil, liste='all_state' def smartlisting_dossier dossiers_list=nil, liste='all_state'
dossiers_list_facade liste dossiers_list_facade liste
service = dossiers_list_facade.service
new_dossiers_list = dossiers_list_facade.service.nouveaux
follow_dossiers_list = dossiers_list_facade.service.suivi
all_state_dossiers_list = dossiers_list_facade.service.all_state
if param_page.nil? if param_page.nil?
params[:dossiers_smart_listing] = {page: dossiers_list_facade.service.default_page} params[:dossiers_smart_listing] = {page: dossiers_list_facade.service.default_page}
end end
smart_listing_create :new_dossiers, default_smart_listing_create :new_dossiers, service.nouveaux
new_dossiers_list, default_smart_listing_create :follow_dossiers, service.suivi
partial: "backoffice/dossiers/list", default_smart_listing_create :all_state_dossiers, service.all_state
array: true, default_smart_listing_create :archived_dossiers, service.archive
default_sort: dossiers_list_facade.service.default_sort
smart_listing_create :follow_dossiers, @archived_dossiers = service.archive
follow_dossiers_list,
partial: "backoffice/dossiers/list",
array: true,
default_sort: dossiers_list_facade.service.default_sort
smart_listing_create :all_state_dossiers,
all_state_dossiers_list,
partial: "backoffice/dossiers/list",
array: true,
default_sort: dossiers_list_facade.service.default_sort
end end
private private
def default_smart_listing_create name, collection
smart_listing_create name,
collection,
partial: 'backoffice/dossiers/list',
array: true,
default_sort: dossiers_list_facade.service.default_sort
end
def param_smart_listing def param_smart_listing
params[:dossiers_smart_listing] params[:dossiers_smart_listing]
end end

View file

@ -17,20 +17,21 @@ class Users::DescriptionController < UsersController
acc acc
end end
unless @dossier.can_be_initiated?
flash[:alert] = t('errors.messages.procedure_archived')
end
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
flash.alert = t('errors.messages.dossier_not_found') flash.alert = t('errors.messages.dossier_not_found')
redirect_to url_for(root_path) redirect_to url_for(root_path)
end end
# def error def update
# show
# flash.now.alert = 'Un ou plusieurs attributs obligatoires sont manquants ou incorrects.'
# render 'show'
# end
def create
@dossier = current_user_dossier @dossier = current_user_dossier
@procedure = @dossier.procedure @procedure = @dossier.procedure
return head :forbidden unless @dossier.can_be_initiated?
@champs = @dossier.ordered_champs @champs = @dossier.ordered_champs
mandatory = true mandatory = true

View file

@ -17,18 +17,9 @@ class Users::RecapitulatifController < UsersController
redirect_to users_dossier_recapitulatif_path redirect_to users_dossier_recapitulatif_path
end end
def submit
create_dossier_facade
@facade.dossier.submit!
flash.notice = 'Dossier déposé avec succès.'
redirect_to users_dossier_recapitulatif_path
end
def self.route_authorization def self.route_authorization
{ {
states: [:initiated, :replied, :updated, :validated, :received, :submitted, :without_continuation, :closed, :refused] states: [:initiated, :replied, :updated, :received, :without_continuation, :closed, :refused]
} }
end end

View file

@ -5,8 +5,6 @@ class MailTemplateDecorator < Draper::Decorator
case object.type case object.type
when "MailReceived" when "MailReceived"
"E-mail d'accusé de réception" "E-mail d'accusé de réception"
when "MailValidated"
"E-mail de validation"
else else
object.type object.type
end end

View file

@ -13,8 +13,11 @@ class AdminProceduresShowFacades
def dossiers_for_pie_highchart def dossiers_for_pie_highchart
dossiers.where.not(state: :draft, archived: true).group(:state).count dossiers.where.not(state: :draft, archived: true).group(:state).count
.map{|key, value| { (DossierDecorator.case_state_fr key) => value } } .reduce({}) do |acc, (key, val)|
.reduce({}, :merge) translated_key = DossierDecorator.case_state_fr(key)
acc[translated_key].nil? ? acc[translated_key] = val : acc[translated_key] += val
acc
end
end end
def dossiers_archived_by_state_total def dossiers_archived_by_state_total

View file

@ -2,7 +2,7 @@ class DossierFacades
#TODO rechercher en fonction de la personne/email #TODO rechercher en fonction de la personne/email
def initialize(dossier_id, email, champ_id = nil) def initialize(dossier_id, email, champ_id = nil)
@dossier = Dossier.where(archived: false).find(dossier_id) @dossier = Dossier.find(dossier_id)
@champ_id = champ_id @champ_id = champ_id
end end

View file

@ -7,10 +7,6 @@ class NotificationMailer < ApplicationMailer
send_mail dossier, dossier.procedure.mail_received.object_for_dossier(dossier) send_mail dossier, dossier.procedure.mail_received.object_for_dossier(dossier)
end end
def dossier_validated dossier
send_mail dossier, dossier.procedure.mail_validated.object_for_dossier(dossier)
end
def dossier_submitted dossier def dossier_submitted dossier
send_mail dossier, "Votre dossier TPS N°#{dossier.id} a été déposé" send_mail dossier, "Votre dossier TPS N°#{dossier.id} a été déposé"
end end

View file

@ -5,8 +5,6 @@ class Dossier < ActiveRecord::Base
initiated: 'initiated', initiated: 'initiated',
replied: 'replied', #action utilisateur demandé replied: 'replied', #action utilisateur demandé
updated: 'updated', #etude par l'administration en cours updated: 'updated', #etude par l'administration en cours
validated: 'validated',
submitted: 'submitted',
received: 'received', received: 'received',
closed: 'closed', closed: 'closed',
refused: 'refused', refused: 'refused',
@ -40,9 +38,10 @@ class Dossier < ActiveRecord::Base
delegate :types_de_champ, to: :procedure delegate :types_de_champ, to: :procedure
delegate :france_connect_information, to: :user delegate :france_connect_information, to: :user
before_validation :update_state_dates, if: -> { state_changed? }
after_save :build_default_champs, if: Proc.new { procedure_id_changed? } after_save :build_default_champs, if: Proc.new { procedure_id_changed? }
after_save :build_default_individual, if: Proc.new { procedure.for_individual? } after_save :build_default_individual, if: Proc.new { procedure.for_individual? }
after_save :internal_notification
validates :user, presence: true validates :user, presence: true
@ -50,14 +49,12 @@ class Dossier < ActiveRecord::Base
NOUVEAUX = %w(initiated) NOUVEAUX = %w(initiated)
OUVERT = %w(updated replied) OUVERT = %w(updated replied)
WAITING_FOR_GESTIONNAIRE = %w(updated) WAITING_FOR_GESTIONNAIRE = %w(updated)
WAITING_FOR_USER = %w(replied validated) WAITING_FOR_USER = %w(replied)
EN_CONSTRUCTION = %w(initiated updated replied) EN_CONSTRUCTION = %w(initiated updated replied)
VALIDES = %w(validated) EN_INSTRUCTION = %w(received)
DEPOSES = %w(submitted)
EN_INSTRUCTION = %w(submitted received)
A_INSTRUIRE = %w(received) A_INSTRUIRE = %w(received)
TERMINE = %w(closed refused without_continuation) TERMINE = %w(closed refused without_continuation)
ALL_STATE = %w(initiated updated replied validated submitted received closed refused without_continuation) ALL_STATE = %w(initiated updated replied received closed refused without_continuation)
def unreaded_notifications def unreaded_notifications
@unreaded_notif ||= notifications.where(already_read: false) @unreaded_notif ||= notifications.where(already_read: false)
@ -108,7 +105,7 @@ class Dossier < ActiveRecord::Base
end end
def next_step! role, action def next_step! role, action
unless %w(initiate follow update comment valid submit receive refuse without_continuation close).include?(action) unless %w(initiate follow update comment receive refuse without_continuation close).include?(action)
fail 'action is not valid' fail 'action is not valid'
end end
@ -122,10 +119,6 @@ class Dossier < ActiveRecord::Base
if draft? if draft?
initiated! initiated!
end end
when 'submit'
if validated?
submitted!
end
when 'update' when 'update'
if replied? if replied?
updated! updated!
@ -147,18 +140,6 @@ class Dossier < ActiveRecord::Base
if initiated? if initiated?
updated! updated!
end end
when 'valid'
if updated?
validated!
elsif replied?
validated!
elsif initiated?
validated!
end
when 'receive'
if submitted?
received!
end
when 'close' when 'close'
if received? if received?
closed! closed!
@ -208,18 +189,6 @@ class Dossier < ActiveRecord::Base
where(state: OUVERT, archived: false).order("updated_at #{order}") where(state: OUVERT, archived: false).order("updated_at #{order}")
end end
def self.valides order = 'ASC'
where(state: VALIDES, archived: false).order("updated_at #{order}")
end
def self.fige order = 'ASC'
where(state: VALIDES, archived: false).order("updated_at #{order}")
end
def self.deposes order = 'ASC'
where(state: DEPOSES, archived: false).order("updated_at #{order}")
end
def self.a_instruire order = 'ASC' def self.a_instruire order = 'ASC'
where(state: A_INSTRUIRE, archived: false).order("updated_at #{order}") where(state: A_INSTRUIRE, archived: false).order("updated_at #{order}")
end end
@ -232,6 +201,8 @@ class Dossier < ActiveRecord::Base
where(state: TERMINE, archived: false).order("updated_at #{order}") where(state: TERMINE, archived: false).order("updated_at #{order}")
end end
scope :archived, -> { where(archived: true) }
def cerfa_available? def cerfa_available?
procedure.cerfa_flag? && cerfa.size != 0 procedure.cerfa_flag? && cerfa.size != 0
end end
@ -324,15 +295,8 @@ class Dossier < ActiveRecord::Base
follows.size follows.size
end end
def submit!
self.deposit_datetime= DateTime.now
next_step! 'user', 'submit'
NotificationMailer.dossier_submitted(self).deliver_now!
end
def read_only? def read_only?
validated? || received? || submitted? || closed? || refused? || without_continuation? received? || closed? || refused? || without_continuation?
end end
def owner? email def owner? email
@ -343,11 +307,20 @@ class Dossier < ActiveRecord::Base
(invites_user.pluck :email).include? email (invites_user.pluck :email).include? email
end end
def can_be_initiated?
!(procedure.archived && draft?)
end
private private
def internal_notification def update_state_dates
if state_changed? && state == 'submitted' if initiated? && !self.initiated_at
NotificationService.new('submitted', self.id).notify self.initiated_at = DateTime.now
elsif received? && !self.received_at
self.received_at = DateTime.now
elsif TERMINE.include?(state)
self.processed_at = DateTime.now
end end
end end
end end

View file

@ -1,18 +0,0 @@
class MailValidated < MailTemplate
before_save :default_values
def default_values
self.object ||= "[TPS] Votre dossier TPS N°--numero_dossier-- a été validé"
self.body ||= "Bonjour,<br>
<br>
Votre dossier N°--numero_dossier-- est prêt à être déposé pour instruction.<br>
<br>
Afin de finaliser son dépôt, merci de vous rendre sur --lien_dossier--.,<br>
<br>
Bonne journée,<br>
---<br>
Merci de ne pas répondre à ce mail. Postez directement vos questions dans votre dossier sur la plateforme.<br>
---<br>
L'équipe TPS"
end
end

View file

@ -1,5 +1,6 @@
class Notification < ActiveRecord::Base class Notification < ActiveRecord::Base
belongs_to :dossier belongs_to :dossier
serialize :liste if Rails.env.test?
# after_save :broadcast_notification # after_save :broadcast_notification

View file

@ -5,7 +5,6 @@ class Procedure < ActiveRecord::Base
has_many :dossiers has_many :dossiers
has_many :mail_templates has_many :mail_templates
has_one :mail_received has_one :mail_received
has_one :mail_validated
has_one :procedure_path, dependent: :destroy has_one :procedure_path, dependent: :destroy
@ -34,7 +33,6 @@ class Procedure < ActiveRecord::Base
def build_default_mails def build_default_mails
MailReceived.create(procedure: self) unless mail_received MailReceived.create(procedure: self) unless mail_received
MailValidated.create(procedure: self) unless mail_validated
end end
def path def path

View file

@ -4,7 +4,10 @@ class DossierProcedureSerializer < ActiveModel::Serializer
:updated_at, :updated_at,
:archived, :archived,
:mandataire_social, :mandataire_social,
:state :state,
:initiated_at,
:received_at,
:processed_at
attribute :followers_gestionnaires_emails, key: :emails_accompagnateurs attribute :followers_gestionnaires_emails, key: :emails_accompagnateurs
end end

View file

@ -8,18 +8,16 @@ class DossiersListGestionnaireService
def dossiers_to_display def dossiers_to_display
@dossiers_to_display ||= @dossiers_to_display ||=
{'nouveaux' => nouveaux, {'nouveaux' => nouveaux,
# 'suivi' => suivi,
'a_traiter' => ouvert, 'a_traiter' => ouvert,
'fige' => fige,
'deposes' => deposes,
'a_instruire' => a_instruire, 'a_instruire' => a_instruire,
'termine' => termine, 'termine' => termine,
'archive' => archive,
'all_state' => all_state}[@liste] 'all_state' => all_state}[@liste]
end end
def self.dossiers_liste_libelle def self.dossiers_liste_libelle
['nouveaux', 'suivi', 'a_traiter', 'fige', 'deposes', 'a_instruire', 'termine', 'all_state'] ['nouveaux', 'suivi', 'a_traiter', 'a_instruire', 'termine', 'all_state']
end end
def all_state def all_state
@ -38,18 +36,14 @@ class DossiersListGestionnaireService
@ouvert ||= filter_dossiers.ouvert @ouvert ||= filter_dossiers.ouvert
end end
def fige
@fige ||= filter_dossiers.fige
end
def deposes
@deposes ||= filter_dossiers.deposes
end
def a_instruire def a_instruire
@a_instruire ||= filter_dossiers.a_instruire @a_instruire ||= filter_dossiers.a_instruire
end end
def archive
@archive ||= filter_dossiers.archived
end
def termine def termine
@termine ||= filter_dossiers.termine @termine ||= filter_dossiers.termine
end end

View file

@ -7,7 +7,6 @@ class DossiersListUserService
def dossiers_to_display def dossiers_to_display
{'brouillon' => brouillon, {'brouillon' => brouillon,
'a_traiter' => en_construction, 'a_traiter' => en_construction,
'valides' => valides,
'en_instruction' => en_instruction, 'en_instruction' => en_instruction,
'termine' => termine, 'termine' => termine,
'invite' => invite, 'invite' => invite,
@ -15,7 +14,7 @@ class DossiersListUserService
end end
def self.dossiers_liste_libelle def self.dossiers_liste_libelle
['brouillon', 'a_traiter', 'valides', 'en_instruction', 'termine', 'invite', 'all_state'] ['brouillon', 'a_traiter', 'en_instruction', 'termine', 'invite', 'all_state']
end end
def all_state def all_state
@ -34,10 +33,6 @@ class DossiersListUserService
@invite ||= @current_devise_profil.invites @invite ||= @current_devise_profil.invites
end end
def valides
@valides ||= @current_devise_profil.dossiers.valides
end
def en_instruction def en_instruction
@en_instruction ||= @current_devise_profil.dossiers.en_instruction @en_instruction ||= @current_devise_profil.dossiers.en_instruction
end end

View file

@ -22,7 +22,6 @@
- MailTemplate::TAGS.each do |balise| - MailTemplate::TAGS.each do |balise|
%tr %tr
%td.center %td.center
%b.text-success
= "--#{balise.first}--" = "--#{balise.first}--"
%td %td
=balise.second[:description] =balise.second[:description]

View file

@ -1,9 +1,9 @@
%table#dossiers_list.table %table#dossiers_list.table
%thead %thead
- if smart_listing.name.to_s == 'follow_dossiers' - if smart_listing.name.to_s == 'follow_dossiers'
%th.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1.center %th.col-xs-1.center
%i.fa.fa-bell %i.fa.fa-bell
%th.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1 %th.col-xs-1
État État
- @facade_data_view.preference_list_dossiers_filter.each do |preference| - @facade_data_view.preference_list_dossiers_filter.each do |preference|
@ -17,14 +17,14 @@
%i.filter.fa.fa-filter{style: "color:#{(preference.filter.blank? ? 'grey' : 'orange')}", id: "filter_#{smart_listing.name.to_s}_#{preference.table_attr.sub('.', '_')}"} %i.filter.fa.fa-filter{style: "color:#{(preference.filter.blank? ? 'grey' : 'orange')}", id: "filter_#{smart_listing.name.to_s}_#{preference.table_attr.sub('.', '_')}"}
= render partial: 'backoffice/dossiers/filter_framed', locals:{preference: preference, filter_framed_id: "framed_filter_#{smart_listing.name.to_s}_#{preference.table_attr.sub('.', '_')}"} = render partial: 'backoffice/dossiers/filter_framed', locals:{preference: preference, filter_framed_id: "framed_filter_#{smart_listing.name.to_s}_#{preference.table_attr.sub('.', '_')}"}
%th.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1.center Actions %th.col-xs-1.center Actions
%th.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1.center Abonnés %th.col-xs-1.center Abonnés
- unless smart_listing.empty? - unless smart_listing.empty?
- smart_listing.collection.each do |dossier| - smart_listing.collection.each do |dossier|
%tr.dossier-row{id: "tr_dossier_#{dossier.id}", 'data-dossier_url' => backoffice_dossier_url(id: dossier.id)} %tr.dossier-row{id: "tr_dossier_#{dossier.id}", 'data-dossier_url' => backoffice_dossier_url(id: dossier.id)}
- if smart_listing.name.to_s == 'follow_dossiers' - if smart_listing.name.to_s == 'follow_dossiers'
%td.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1.center %td.col-xs-1.center
- total_notif = dossier.notifications.where(already_read: false).count - total_notif = dossier.notifications.where(already_read: false).count
- if total_notif == 0 - if total_notif == 0
.badge.progress-bar-default .badge.progress-bar-default
@ -32,7 +32,7 @@
- else - else
.badge.progress-bar-warning .badge.progress-bar-warning
= total_notif = total_notif
%td.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1 %td.col-xs-1
= dossier.decorate.display_state = dossier.decorate.display_state
- @facade_data_view.preference_list_dossiers_filter.each_with_index do |preference, index| - @facade_data_view.preference_list_dossiers_filter.each_with_index do |preference, index|
- unless preference.libelle == 'Statut' || preference.libelle == 'État' - unless preference.libelle == 'Statut' || preference.libelle == 'État'

View file

@ -3,53 +3,62 @@
= render partial: 'backoffice/dossiers/pref_list' = render partial: 'backoffice/dossiers/pref_list'
.default_data_block .default_data_block
%div.row.show-block#new_dossiers .row.show-block#new_dossiers
%div.header .header
%div.col-lg-10.col-md-10.col-sm-10.col-xs-10.title .col-xs-10.title
%div.carret-right .carret-right
%div.carret-down .carret-down
Nouveaux dossiers Nouveaux dossiers
%div.col-lg-2.col-md-2.col-sm-2.col-xs-2.count .col-xs-2.count
=@facade_data_view.nouveaux_total = pluralize(@facade_data_view.nouveaux_total, "dossier")
dossiers .body
%div.body
= smart_listing_render :new_dossiers = smart_listing_render :new_dossiers
.row.center .row.center
.col-lg-1.col-md-1.col-sm-1.col-xs-1 .col-xs-3
.col-lg-2.col-md-2.col-sm-2.col-xs-2
=link_to 'Tous les états', '?liste=all_state', class: 'text-info', style:"text-decoration: #{@facade_data_view.liste == 'all_state'? 'underline' : ''}" =link_to 'Tous les états', '?liste=all_state', class: 'text-info', style:"text-decoration: #{@facade_data_view.liste == 'all_state'? 'underline' : ''}"
.col-lg-2.col-md-2.col-sm-2.col-xs-2 .col-xs-3
=link_to 'En construction', '?liste=a_traiter', class: 'text-danger', style:"text-decoration: #{@facade_data_view.liste == 'a_traiter'? 'underline' : ''}" =link_to 'En construction', '?liste=a_traiter', class: 'text-danger', style:"text-decoration: #{@facade_data_view.liste == 'a_traiter'? 'underline' : ''}"
.col-lg-2.col-md-2.col-sm-2.col-xs-2 .col-xs-3
=link_to 'À receptionner', '?liste=deposes', class: 'text-purple', style:"text-decoration: #{@facade_data_view.liste == 'deposes'? 'underline' : ''}" =link_to 'En instruction', '?liste=a_instruire', class: 'text-warning', style:"text-decoration: #{@facade_data_view.liste == 'a_instruire'? 'underline' : ''}"
.col-lg-2.col-md-2.col-sm-2.col-xs-2 .col-xs-3
=link_to 'À instruire', '?liste=a_instruire', class: 'text-warning', style:"text-decoration: #{@facade_data_view.liste == 'a_instruire'? 'underline' : ''}"
.col-lg-2.col-md-2.col-sm-2.col-xs-2
=link_to 'Terminés', '?liste=termine', class: 'text-success', style:"text-decoration: #{@facade_data_view.liste == 'termine'? 'underline' : ''}" =link_to 'Terminés', '?liste=termine', class: 'text-success', style:"text-decoration: #{@facade_data_view.liste == 'termine'? 'underline' : ''}"
.default_data_block.default_visible .default_data_block.default_visible
%div.row.show-block#follow_dossiers .row.show-block#follow_dossiers
%div.header .header
%div.col-lg-10.col-md-10.col-sm-10.col-xs-10.title .col-xs-10.title
%div.carret-right .carret-right
%div.carret-down .carret-down
Dossiers suivis Dossiers suivis
%div.col-lg-2.col-md-2.col-sm-2.col-xs-2.count .col-xs-2.count
=@facade_data_view.suivi_total = pluralize(@facade_data_view.suivi_total, "dossier")
dossiers .body
%div.body
= smart_listing_render :follow_dossiers = smart_listing_render :follow_dossiers
.default_data_block .default_data_block
%div.row.show-block#all_dossiers .row.show-block#all_dossiers
%div.header .header
%div.col-lg-10.col-md-10.col-sm-10.col-xs-10.title .col-xs-10.title
%div.carret-right .carret-right
%div.carret-down .carret-down
Tous les dossiers Tous les dossiers
%div.col-lg-2.col-md-2.col-sm-2.col-xs-2.count .col-xs-2.count
=@facade_data_view.all_state_total = pluralize(@facade_data_view.all_state_total, "dossier")
dossiers .body
%div.body
= smart_listing_render :all_state_dossiers = smart_listing_render :all_state_dossiers
- if @archived_dossiers
.default_data_block
.row.show-block#archived_dossiers
.header
.col-xs-10.title
.carret-right
.carret-down
Dossiers archivés
.col-xs-2.count
= pluralize(@archived_dossiers.count, "dossier")
.body
= smart_listing_render :archived_dossiers

View file

@ -1,2 +1,2 @@
%div.col-lg-12.col-md-12.col-sm-12.col-xs-12#backoffice_dossier_show #backoffice_dossier_show.col-xs-12
= render partial: "dossiers/dossier_show" = render partial: "dossiers/dossier_show"

View file

@ -1,4 +1,4 @@
%div#main-container{class: "col-lg-#{main_container_size} col-md-#{main_container_size}"} %div#main-container{class: "col-xs-#{main_container_size}"}
%div.row %div.row
= render partial: 'layouts/flash_messages' = render partial: 'layouts/flash_messages'
%div.row %div.row

View file

@ -1,14 +1,14 @@
%div.col-lg-2.col-md-2.col-sm-2.col-xs-2 .col-xs-2
%a#title_navbar{href: '/'} %a#title_navbar{href: '/'}
%div.row#home .row#home
%div.col-lg-6.no-padding .col-lg-6.no-padding
= image_tag('marianne_small.png', class: 'logo') = image_tag('marianne_small.png', class: 'logo')
%div.col-lg-6.no-padding#tps-title .col-lg-6.no-padding#tps-title
TPS TPS
%div.col-lg-10.col-md-10.col-sm-10.col-xs-10.no-padding .col-xs-10.no-padding
%div#navbar-body #navbar-body
%div.row .row
-begin -begin
= render partial: @navbar_url = render partial: @navbar_url
-rescue -rescue

View file

@ -1,17 +1,12 @@
%div#first-block #first-block
%div.infos .infos
#dossier_id= t('dynamics.dossiers.numéro') + @facade.dossier.id.to_s #dossier_id= t('dynamics.dossiers.numéro') + @facade.dossier.id.to_s
%div#action-block #action-block
- if gestionnaire_signed_in? - if gestionnaire_signed_in?
- if !@facade.dossier.read_only? - if !@facade.dossier.read_only? || @facade.dossier.initiated?
= form_tag(url_for({controller: 'backoffice/dossiers', action: :valid, dossier_id: @facade.dossier.id}), class: 'form-inline', method: 'POST') do = link_to 'Passer en instruction', backoffice_dossier_receive_path(@facade.dossier), method: :post, class: 'btn btn-danger btn-block'
%button.action{'data-toggle' => :tooltip, title: 'En cliquant ici, vous figez le dossier et autorisez le dépôt du dossier pour instruction.'}
= 'Déclarer complet'.upcase
- elsif @facade.dossier.submitted?
= form_tag(url_for({controller: 'backoffice/dossiers', action: :receive, dossier_id: @facade.dossier.id}), class: 'form-inline', method: 'POST') do
%button.action
= 'Accuser réception'.upcase
- elsif @facade.dossier.received? - elsif @facade.dossier.received?
= form_tag(url_for({controller: 'backoffice/dossiers', action: :close, dossier_id: @facade.dossier.id}), class: 'form-inline action_button', method: 'POST', style: 'display:inline', 'data-toggle' => :tooltip, title: 'Accepter') do = form_tag(url_for({controller: 'backoffice/dossiers', action: :close, dossier_id: @facade.dossier.id}), class: 'form-inline action_button', method: 'POST', style: 'display:inline', 'data-toggle' => :tooltip, title: 'Accepter') do
%button.action.close-dossier %button.action.close-dossier
@ -22,19 +17,26 @@
= form_tag(url_for({controller: 'backoffice/dossiers', action: :refuse, dossier_id: @facade.dossier.id}), class: 'form-inline action_button', method: 'POST', style: 'display:inline', 'data-toggle' => :tooltip, title: 'Refuser') do = form_tag(url_for({controller: 'backoffice/dossiers', action: :refuse, dossier_id: @facade.dossier.id}), class: 'form-inline action_button', method: 'POST', style: 'display:inline', 'data-toggle' => :tooltip, title: 'Refuser') do
%button.action.refuse-dossier %button.action.refuse-dossier
%i.fa.fa-times %i.fa.fa-times
= link_to 'Reouvrir', backoffice_dossier_reopen_path(@facade.dossier), method: :post, class: 'btn btn-default btn-block'
- unless @facade.dossier.archived? %hr
= link_to 'Archiver', backoffice_dossier_archive_path(@facade.dossier), method: :post, class: 'btn btn-default btn-block' - if @facade.dossier.archived?
%p
Archivé
= link_to 'Désarchiver', unarchive_backoffice_dossier_path(@facade.dossier), method: :post, class: 'btn btn-default btn-block'
- else
= link_to 'Archiver', archive_backoffice_dossier_path(@facade.dossier), method: :post, class: 'btn btn-default btn-block'
%div#menu-block #menu-block
%div#infos-block #infos-block
%div.split-hr-left .split-hr-left
%div.dossier-state= @facade.dossier.display_state .dossier-state= @facade.dossier.display_state
%div.split-hr-left .split-hr-left
%div.notifications .notifications
- if @facade.dossier.notifications.empty? - if @facade.dossier.notifications.empty?
Aucune notification pour le moment. Aucune notification pour le moment.
- else - else

View file

@ -23,21 +23,15 @@
.badge.progress-bar-danger .badge.progress-bar-danger
= @dossiers_list_facade.en_construction_total = @dossiers_list_facade.en_construction_total
%a{:href => "#{url_for users_dossiers_path(liste: 'valides')}", 'data-toggle' => :tooltip, title: 'Les dossiers relus par votre accompagnateur pouvant être déposés pour examen.'}
%div.procedure_list_element{ class: @dossiers_list_facade.valides_class, id: 'valides' }
="À déposer"
.badge.progress-bar-purple
= @dossiers_list_facade.valides_total
%a{:href => "#{url_for users_dossiers_path(liste: 'en_instruction')}", 'data-toggle' => :tooltip, title: 'Les dossiers en cours d\'examen par l\'administration compétante.'} %a{:href => "#{url_for users_dossiers_path(liste: 'en_instruction')}", 'data-toggle' => :tooltip, title: 'Les dossiers en cours d\'examen par l\'administration compétante.'}
%div.procedure_list_element{ class: @dossiers_list_facade.en_instruction_class, id: 'en_instruction' } %div.procedure_list_element{ class: @dossiers_list_facade.en_instruction_class, id: 'en_instruction' }
="En examen" ="En instruction"
.badge.progress-bar-default .badge.progress-bar-default
= @dossiers_list_facade.en_instruction_total = @dossiers_list_facade.en_instruction_total
%a{:href => "#{url_for users_dossiers_path(liste: 'termine')}", 'data-toggle' => :tooltip, title: 'Les dossiers cloturés qui peuvent être "Accepté", "Refusé" ou "Sans suite".'} %a{:href => "#{url_for users_dossiers_path(liste: 'termine')}", 'data-toggle' => :tooltip, title: 'Les dossiers cloturés qui peuvent être "Accepté", "Refusé" ou "Sans suite".'}
%div.procedure_list_element{ class: @dossiers_list_facade.termine_class, id: 'termine' } %div.procedure_list_element{ class: @dossiers_list_facade.termine_class, id: 'termine' }
= "Cloturé" = "Terminé"
.badge.progress-bar-success .badge.progress-bar-success
= @dossiers_list_facade.termine_total = @dossiers_list_facade.termine_total

View file

@ -4,11 +4,6 @@
%div.infos %div.infos
%div= t('dynamics.dossiers.numéro') + @facade.dossier.id.to_s %div= t('dynamics.dossiers.numéro') + @facade.dossier.id.to_s
%div#action-block
- if @facade.dossier.validated? && @facade.dossier.user == current_user
= form_tag(url_for({controller: 'users/recapitulatif', action: :submit, dossier_id: @facade.dossier.id}), method: 'POST') do
%button#validate_button.action= 'Procéder au dépôt définitif'
%div#menu-block %div#menu-block
%div#infos-block %div#infos-block

View file

@ -1,6 +1,6 @@
%div.col-lg-8.col-md-8.col-sm-8.col-xs-8.main-info .col-xs-7.main-info
%div.col-lg-3.col-md-3.col-sm-3.col-xs-3.options .col-xs-3.options
%div{ style: "decorate:none; display: flex;box-shadow:none; float:right; display: flex; margin-top: 5px" } %div{ style: "decorate:none; display: flex;box-shadow:none; float:right; display: flex; margin-top: 5px" }
%div{ style: "vertical-align: middle; margin-right: 10px; margin-top: auto; margin-bottom: auto;" } %div{ style: "vertical-align: middle; margin-right: 10px; margin-top: auto; margin-bottom: auto;" }
= current_administrateur.email = current_administrateur.email

View file

@ -1,4 +1,4 @@
%div.col-lg-8.col-md-8.col-sm-8.col-xs-8.main-info .col-xs-7.main-info
= @facade_data_view.procedure_id.nil? ? "Tous les dossiers" : @facade_data_view.procedure.libelle = @facade_data_view.procedure_id.nil? ? "Tous les dossiers" : @facade_data_view.procedure.libelle
%div.col-lg-3.col-md-3.col-sm-3.col-xs-3.options %div.col-lg-3.col-md-3.col-sm-3.col-xs-3.options
%div.row %div.row

View file

@ -1,2 +1,2 @@
%div.col-lg-11.col-md-11.col-sm-11.col-xs-11.main-info .col-xs-10.main-info
Recherche dans tous les dossiers Recherche dans tous les dossiers

View file

@ -1,9 +1,9 @@
%div.col-lg-8.col-md-8.col-sm-8.col-xs-8.main-info .col-xs-7.main-info
%span{ 'data-toggle' => :tooltip, "data-placement" => :bottom, title: @facade.dossier.procedure.libelle } %span{ 'data-toggle' => :tooltip, "data-placement" => :bottom, title: @facade.dossier.procedure.libelle }
= @facade.dossier.procedure.libelle = @facade.dossier.procedure.libelle
%div.col-lg-3.col-md-3.col-sm-3.col-xs-3.options .col-xs-3.options
%div.row .row
%div.col-lg-12.col-md-12.col-sm-12.col-xs-12 .col-xs-12
- if current_gestionnaire.follow?(@facade.dossier.id) - if current_gestionnaire.follow?(@facade.dossier.id)
= link_to backoffice_dossier_follow_path(dossier_id: @facade.dossier.id), "data-method" => :put, class: "button-navbar-action",id: "suivre_dossier_#{@facade.dossier.id}" do = link_to backoffice_dossier_follow_path(dossier_id: @facade.dossier.id), "data-method" => :put, class: "button-navbar-action",id: "suivre_dossier_#{@facade.dossier.id}" do
%i.fa.fa-user-times %i.fa.fa-user-times
@ -12,14 +12,14 @@
= link_to backoffice_dossier_follow_path(dossier_id: @facade.dossier.id), 'data-method' => :put, class: 'button-navbar-action', id: "suivre_dossier_#{@facade.dossier.id}" do = link_to backoffice_dossier_follow_path(dossier_id: @facade.dossier.id), 'data-method' => :put, class: 'button-navbar-action', id: "suivre_dossier_#{@facade.dossier.id}" do
%i.fa.fa-user-plus %i.fa.fa-user-plus
Suivre le dossier Suivre le dossier
%div.row .row
%div.col-lg-12.col-md-12.col-sm-12.col-xs-12 .col-xs-12
%div#invitations.dropdown-toggle{ 'data-toggle' => 'dropdown', 'aria-haspopup' => true, 'aria-expanded' => false } #invitations.dropdown-toggle{ 'data-toggle' => 'dropdown', 'aria-haspopup' => true, 'aria-expanded' => false }
%i.fa.fa-user %i.fa.fa-user
= t('utils.involved') = t('utils.involved')
.badge.progress-bar-info .badge.progress-bar-info
= @facade.dossier.invites.count = @facade.dossier.invites.count
%div.dropdown-menu.dropdown-menu-right.dropdown-pannel .dropdown-menu.dropdown-menu-right.dropdown-pannel
%h4= t('dynamics.dossiers.followers.title') %h4= t('dynamics.dossiers.followers.title')
%ul %ul
- unless @facade.followers.empty? - unless @facade.followers.empty?

View file

@ -1 +1 @@
.col-lg-11.col-md-11.col-sm-11.col-xs-11 .col-xs-10

View file

@ -1,17 +1,15 @@
-#%span.fa.fa-sign-out
-if user_signed_in? -if user_signed_in?
.col-lg-1.col-md-1.col-sm-1.col-xs-1#sign_out.no-padding #sign_out.col-xs-2.no-padding
= render partial: 'users/login_banner' = render partial: 'users/login_banner'
= render partial: 'layouts/credentials' = render partial: 'layouts/credentials'
-elsif gestionnaire_signed_in? -elsif gestionnaire_signed_in?
.col-lg-1.col-md-1.col-sm-1.col-xs-1#sign_out.no-padding #sign_out.col-xs-2.no-padding
= render partial: 'gestionnaires/login_banner' = render partial: 'gestionnaires/login_banner'
= render partial: 'layouts/credentials' = render partial: 'layouts/credentials'
-elsif administrateur_signed_in? -elsif administrateur_signed_in?
.col-lg-1.col-md-1.col-sm-1.col-xs-1#sign_out.no-padding #sign_out.col-xs-2.no-padding
= render partial: 'administrateurs/login_banner' = render partial: 'administrateurs/login_banner'
= render partial: 'layouts/credentials' = render partial: 'layouts/credentials'
-else -else
.col-lg-1.col-md-1.col-sm-1.col-xs-1#sign_in #sign_in.col-xs-2
= link_to "Connexion", '/users/sign_in', :class => 'btn btn-lg' = link_to "Connexion", new_user_session_path, :class => 'btn btn-lg btn-primary'

View file

@ -1,4 +1,4 @@
%div.col-lg-8.col-md-8.col-sm-8.col-xs-8.main-info .col-xs-7.main-info
%span{ 'data-toggle' => :tooltip, "data-placement" => :bottom, title: @facade.dossier.procedure.libelle } %span{ 'data-toggle' => :tooltip, "data-placement" => :bottom, title: @facade.dossier.procedure.libelle }
= @facade.dossier.procedure.libelle.truncate(60) = @facade.dossier.procedure.libelle.truncate(60)
%div.col-lg-3.col-md-3.col-sm-3.col-xs-3.options %div.col-lg-3.col-md-3.col-sm-3.col-xs-3.options

View file

@ -1 +0,0 @@
<%= @dossier.procedure.mail_validated.body_for_dossier(@dossier).html_safe %>

View file

@ -1,18 +1,20 @@
#landing.max-size #landing.max-size
#title #title
.center
= image_tag 'logos/logo-tps.png', id: 'logo-tps'
%h1.center %h1.center
%img#logo-tps{src: image_url('logos/logo-tps.png')}
%h2.center
TéléProcédure Simplifiée TéléProcédure Simplifiée
%h3.center .row
Plateforme publique pour réaliser des démarches administratives 100% en ligne. .col-md-8.col-md-push-2.center
%h3
Dématérialisez n'importe quelle démarche administrative en quelques minutes,
avec un outil
%strong
gratuit, simple, collaboratif et sûr
%br %p.mt-1 Vous êtes intéressés ?
%br %p= link_to 'Programmer une démo', "mailto:#{t('dynamics.contact_email')}?subject=Demande de démo TPS", target: '_blank', class: 'btn btn-danger btn-lg'
.center
%button.background-tps.js-scrollTo.btn.btn-lg{cible: '.demo_account'}
Envie d'essayer ?
#landing_body.max-size #landing_body.max-size
.row#etapes.center .row#etapes.center
@ -55,8 +57,7 @@
%h3.text-success Usagers %h3.text-success Usagers
%h4 Profitez de démarches simplifiées et déchanges continus avec les services traitants. %h4 Profitez de démarches simplifiées et déchanges continus avec les services traitants.
=link_to 'Démonstration', "#{@demo_environment_host}/users/sign_in/demo", {class: 'btn btn-lg btn-success'} =link_to 'Démonstration', "#{@demo_environment_host}/users/sign_in/demo", {class: 'btn btn-lg btn-success'}
%h1
= @demo_environment_host
.split-hr-left .split-hr-left
.center .center

View file

@ -15,7 +15,7 @@
= @dossier.procedure.libelle = @dossier.procedure.libelle
-#TODO use form_for -#TODO use form_for
= form_tag(url_for({controller: 'users/description', action: :create, dossier_id: @dossier.id}), class: 'form', method: 'POST', multipart: true) do = form_tag(url_for({controller: 'users/description', action: :update, dossier_id: @dossier.id}), class: 'form', method: 'POST', multipart: true) do
-unless @champs.nil? -unless @champs.nil?
#liste_champs #liste_champs
=render partial: 'users/description/champs', locals:{private: false} =render partial: 'users/description/champs', locals:{private: false}
@ -41,16 +41,16 @@
Vous pourrez dans tous les cas les compléter plus tard si vous ne les possédez pas de suite. Vous pourrez dans tous les cas les compléter plus tard si vous ne les possédez pas de suite.
-route = Rails.application.routes.recognize_path(request.referrer) -route = Rails.application.routes.recognize_path(request.referrer) # WTF ?
- unless route[:controller].match('admin') - unless route[:controller].match('admin')
%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.draft? - if !@dossier.can_be_initiated?
.alert.alert-danger
= t('errors.messages.procedure_archived')
- elsif !@dossier.draft?
= render partial: '/layouts/modifications_terminees' = render partial: '/layouts/modifications_terminees'
- else - else
= submit_tag 'Soumettre mon dossier', id: 'suivant', name: 'submit[nouveaux]', class: %w(btn btn btn-success), style: 'float:right', data: { disable_with: 'Soumettre votre dossier', submit: true} = submit_tag 'Soumettre mon dossier', id: 'suivant', name: 'submit[nouveaux]', class: 'btn btn btn-success', style: 'float:right', disabled: @procedure.archived?, data: { disable_with: 'Soumettre votre dossier', submit: true}
= submit_tag 'Enregistrer un brouillon', id: 'brouillon', name: 'submit[brouillon]', class: %w(btn btn-xs btn-default), style: 'float:right; margin-right: 10px; margin-top: 6px', data: {disable_with: 'Enregistrer un brouillon', submit: true} = submit_tag 'Enregistrer un brouillon', id: 'brouillon', name: 'submit[brouillon]', class: 'btn btn-xs btn-default', style: 'float:right; margin-right: 10px; margin-top: 6px', disabled: @procedure.archived?, data: {disable_with: 'Enregistrer un brouillon', submit: true}
%br
%br

3
circle.yml Normal file
View file

@ -0,0 +1,3 @@
database:
override:
- bundle exec rake db:drop db:create db:migrate RAILS_ENV=test

View file

@ -10,12 +10,7 @@ development:
test: test:
adapter: postgresql adapter: sqlite3
encoding: unicode
database: tps_test<%= ENV['TEST_ENV_NUMBER'] %>
host: localhost
pool: 5 pool: 5
username: tps timeout: 5000
password: lol database: db/test<%= ENV['TEST_ENV_NUMBER'] %>.sqlite3

View file

@ -87,7 +87,6 @@ set :shared_paths, [
'config/france_connect.yml', 'config/france_connect.yml',
'config/initializers/mailjet.rb', 'config/initializers/mailjet.rb',
'config/initializers/storage_url.rb', 'config/initializers/storage_url.rb',
'app/views/root/landing.html.haml',
'app/views/layouts/_google_analytics.html', 'app/views/layouts/_google_analytics.html',
'app/views/cgu/index.html.haml' 'app/views/cgu/index.html.haml'
] ]

View file

@ -1,2 +1,14 @@
FRANCE_CONNECT = if !Rails.env.test?
file_path = "#{Rails.root}/config/france_connect.yml" file_path = "#{Rails.root}/config/france_connect.yml"
FRANCE_CONNECT = Hashie::Mash.load(file_path) Hashie::Mash.load(file_path)
else
Hashie::Mash.new({
particulier_identifier: 'plop',
particulier_secret: 'plip',
particulier_redirect_uri: 'https://bidon.com/endpoint',
particulier_authorization_endpoint: 'https://bidon.com/endpoint',
particulier_token_endpoint: 'https://bidon.com/endpoint',
particulier_userinfo_endpoint: 'https://bidon.com/endpoint',
particulier_logout_endpoint: 'https://bidon.com/endpoint',
})
end

View file

@ -147,6 +147,7 @@ fr:
france_connect: france_connect:
connexion: "Erreur lors de la connexion à France Connect." connexion: "Erreur lors de la connexion à France Connect."
extension_white_list_error: "Le format de fichier de la pièce jointe n'est pas valide." extension_white_list_error: "Le format de fichier de la pièce jointe n'est pas valide."
procedure_archived: "Cette démarche en ligne a été fermée, il n'est plus possible de déposer de dossier."
datetime: datetime:
distance_in_words: distance_in_words:

View file

@ -9,11 +9,9 @@ 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: "Nouveau" initiated: "En construction"
replied: "En construction" replied: "En construction"
updated: "En construction" updated: "En construction"
validated: "Figé"
submitted: "Déposé / À réceptionner"
received: "En instruction" received: "En instruction"
closed: "Accepté" closed: "Accepté"
refused: "Refusé" refused: "Refusé"

View file

@ -63,15 +63,13 @@ Rails.application.routes.draw do
resources :dossiers do resources :dossiers do
get '/add_siret' => 'dossiers/add_siret#show' get '/add_siret' => 'dossiers/add_siret#show'
get '/description' => 'description#show' get 'description' => 'description#show'
# get '/description/error' => 'description#error' post 'description' => 'description#update'
post 'description' => 'description#create'
patch 'pieces_justificatives' => 'description#pieces_justificatives' patch 'pieces_justificatives' => 'description#pieces_justificatives'
get '/recapitulatif' => 'recapitulatif#show' get '/recapitulatif' => 'recapitulatif#show'
post '/recapitulatif/initiate' => 'recapitulatif#initiate' post '/recapitulatif/initiate' => 'recapitulatif#initiate'
post '/recapitulatif/submit' => 'recapitulatif#submit'
post '/commentaire' => 'commentaires#create' post '/commentaire' => 'commentaires#create'
resources :commentaires, only: [:index] resources :commentaires, only: [:index]
@ -159,18 +157,19 @@ Rails.application.routes.draw do
resource :private_formulaire resource :private_formulaire
resources :dossiers do resources :dossiers do
post 'valid' => 'dossiers#valid'
post 'receive' => 'dossiers#receive' post 'receive' => 'dossiers#receive'
post 'refuse' => 'dossiers#refuse' post 'refuse' => 'dossiers#refuse'
post 'without_continuation' => 'dossiers#without_continuation' post 'without_continuation' => 'dossiers#without_continuation'
post 'close' => 'dossiers#close' post 'close' => 'dossiers#close'
post 'archive' => 'dossiers#archive' member do
post 'archive'
post 'unarchive'
end
post 'reopen' => 'dossiers#reopen'
put 'follow' => 'dossiers#follow' put 'follow' => 'dossiers#follow'
resources :commentaires, only: [:index] resources :commentaires, only: [:index]
end end
namespace :dossiers do namespace :dossiers do
post 'filter' post 'filter'

View file

@ -16,8 +16,8 @@ class DeviseCreateUsers < ActiveRecord::Migration
t.integer :sign_in_count, default: 0, null: false t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at t.datetime :current_sign_in_at
t.datetime :last_sign_in_at t.datetime :last_sign_in_at
t.inet :current_sign_in_ip t.string :current_sign_in_ip
t.inet :last_sign_in_ip t.string :last_sign_in_ip
## Confirmable ## Confirmable
# t.string :confirmation_token # t.string :confirmation_token

View file

@ -16,8 +16,8 @@ class DeviseCreatePros < ActiveRecord::Migration
t.integer :sign_in_count, default: 0, null: false t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at t.datetime :current_sign_in_at
t.datetime :last_sign_in_at t.datetime :last_sign_in_at
t.inet :current_sign_in_ip t.string :current_sign_in_ip
t.inet :last_sign_in_ip t.string :last_sign_in_ip
## Confirmable ## Confirmable
# t.string :confirmation_token # t.string :confirmation_token

View file

@ -16,8 +16,8 @@ class DeviseCreateGestionnaires < ActiveRecord::Migration
t.integer :sign_in_count, default: 0, null: false t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at t.datetime :current_sign_in_at
t.datetime :last_sign_in_at t.datetime :last_sign_in_at
t.inet :current_sign_in_ip t.string :current_sign_in_ip
t.inet :last_sign_in_ip t.string :last_sign_in_ip
## Confirmable ## Confirmable
# t.string :confirmation_token # t.string :confirmation_token

View file

@ -16,8 +16,8 @@ class CreateUsers < ActiveRecord::Migration
t.integer :sign_in_count, default: 0, null: false t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at t.datetime :current_sign_in_at
t.datetime :last_sign_in_at t.datetime :last_sign_in_at
t.inet :current_sign_in_ip t.string :current_sign_in_ip
t.inet :last_sign_in_ip t.string :last_sign_in_ip
## Confirmable ## Confirmable
# t.string :confirmation_token # t.string :confirmation_token

View file

@ -16,8 +16,8 @@ class DeviseCreateAdministrateurs < ActiveRecord::Migration
t.integer :sign_in_count, default: 0, null: false t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at t.datetime :current_sign_in_at
t.datetime :last_sign_in_at t.datetime :last_sign_in_at
t.inet :current_sign_in_ip t.string :current_sign_in_ip
t.inet :last_sign_in_ip t.string :last_sign_in_ip
## Confirmable ## Confirmable
# t.string :confirmation_token # t.string :confirmation_token

View file

@ -1,7 +1,11 @@
class ChangeDateCreationTypeToEntreprise < ActiveRecord::Migration class ChangeDateCreationTypeToEntreprise < ActiveRecord::Migration
def up def up
if Rails.env.test?
change_column :entreprises, :date_creation, "timestamp"
else
change_column :entreprises, :date_creation, "timestamp USING to_timestamp(date_creation) at time zone 'UTC-2'" change_column :entreprises, :date_creation, "timestamp USING to_timestamp(date_creation) at time zone 'UTC-2'"
end end
end
def down def down
change_column :entreprises, :date_creation, "integer USING extract(epoch from date_creation::timestamp with time zone)::integer" change_column :entreprises, :date_creation, "integer USING extract(epoch from date_creation::timestamp with time zone)::integer"

View file

@ -16,8 +16,8 @@ class DeviseCreateAdministrations < ActiveRecord::Migration
t.integer :sign_in_count, default: 0, null: false t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at t.datetime :current_sign_in_at
t.datetime :last_sign_in_at t.datetime :last_sign_in_at
t.inet :current_sign_in_ip t.string :current_sign_in_ip
t.inet :last_sign_in_ip t.string :last_sign_in_ip
## Confirmable ## Confirmable
# t.string :confirmation_token # t.string :confirmation_token

View file

@ -4,14 +4,14 @@ class FixDefaultTypeOnTypeDeChampTable < ActiveRecord::Migration
end end
def up def up
TypeDeChamp.where("private = false").update_all("type = 'TypeDeChampPublic'") TypeDeChamp.where(private: false).update_all("type = 'TypeDeChampPublic'")
TypeDeChamp.where("private = true").update_all("type = 'TypeDeChampPrivate'") TypeDeChamp.where(private: true).update_all("type = 'TypeDeChampPrivate'")
remove_column :types_de_champ, :private remove_column :types_de_champ, :private
end end
def down def down
add_column :types_de_champ, :private, :boolean, default: true add_column :types_de_champ, :private, :boolean, default: true
TypeDeChamp.where("type = 'TypeDeChampPublic'").update_all("private = false") TypeDeChamp.where("type = 'TypeDeChampPublic'").update_all(private: false)
TypeDeChamp.where("type = 'TypeDeChampPrivate'").update_all("private = true") TypeDeChamp.where("type = 'TypeDeChampPrivate'").update_all(private: true)
end end
end end

View file

@ -9,7 +9,7 @@ class CreateSearches < ActiveRecord::Migration
add_index :individuals, :dossier_id add_index :individuals, :dossier_id
add_index :pieces_justificatives, :dossier_id add_index :pieces_justificatives, :dossier_id
add_index :rna_informations, :entreprise_id add_index :rna_informations, :entreprise_id
create_view :searches #, materialized: true create_view :searches unless Rails.env.test? #, materialized: true
end end
def down def down
@ -22,6 +22,6 @@ class CreateSearches < ActiveRecord::Migration
remove_index :individuals, :dossier_id remove_index :individuals, :dossier_id
remove_index :pieces_justificatives, :dossier_id remove_index :pieces_justificatives, :dossier_id
remove_index :rna_informations, :entreprise_id remove_index :rna_informations, :entreprise_id
drop_view :searches #, materialized: true drop_view :searches unless Rails.env.test? #, materialized: true
end end
end end

View file

@ -1,9 +1,9 @@
class UpdateSearchesToVersion2 < ActiveRecord::Migration class UpdateSearchesToVersion2 < ActiveRecord::Migration
def up def up
replace_view :searches, version: 2 replace_view :searches, version: 2 unless Rails.env.test?
end end
def down def down
replace_view :searches, version: 1 replace_view :searches, version: 1 unless Rails.env.test?
end end
end end

View file

@ -1,9 +0,0 @@
class InitMailValidatedForAllProcedure < ActiveRecord::Migration[5.0]
def change
Procedure.all.each do |p|
unless p.mail_validated
p.mail_templates << MailValidated.create
end
end
end
end

View file

@ -0,0 +1,5 @@
class RemoveUselessDossierStates < ActiveRecord::Migration[5.0]
def change
Dossier.where(state: [:validated, :submitted]).update_all(state: :initiated)
end
end

View file

@ -0,0 +1,5 @@
class DeleteAllMailValidatedInDb < ActiveRecord::Migration[5.0]
def change
MailTemplate.where(type: "MailValidated").delete_all
end
end

View file

@ -0,0 +1,7 @@
class AddStateDatesToDossiers < ActiveRecord::Migration[5.0]
def change
add_column :dossiers, :initiated_at, :datetime
add_column :dossiers, :received_at, :datetime
add_column :dossiers, :processed_at, :datetime
end
end

View file

@ -0,0 +1,29 @@
class MoveInetColumnToString < ActiveRecord::Migration[5.0]
def up
change_column :users, :last_sign_in_ip, 'string'
change_column :users, :current_sign_in_ip, 'string'
change_column :gestionnaires, :last_sign_in_ip, 'string'
change_column :gestionnaires, :current_sign_in_ip, 'string'
change_column :administrateurs, :last_sign_in_ip, 'string'
change_column :administrateurs, :current_sign_in_ip, 'string'
change_column :administrations, :last_sign_in_ip, 'string'
change_column :administrations, :current_sign_in_ip, 'string'
end
def down
change_column :users, :last_sign_in_ip, 'inet USING last_sign_in_ip::inet'
change_column :users, :current_sign_in_ip, 'inet USING last_sign_in_ip::inet'
change_column :gestionnaires, :last_sign_in_ip, 'inet USING last_sign_in_ip::inet'
change_column :gestionnaires, :current_sign_in_ip, 'inet USING last_sign_in_ip::inet'
change_column :administrateurs, :last_sign_in_ip, 'inet USING last_sign_in_ip::inet'
change_column :administrateurs, :current_sign_in_ip, 'inet USING last_sign_in_ip::inet'
change_column :administrations, :last_sign_in_ip, 'inet USING last_sign_in_ip::inet'
change_column :administrations, :current_sign_in_ip, 'inet USING last_sign_in_ip::inet'
end
end

View file

@ -0,0 +1,8 @@
class RemoveDepositDatetimeFromDossiers < ActiveRecord::Migration[5.0]
def change
Dossier.where.not(deposit_datetime: nil).each do |dossier|
dossier.update(initiated_at: dossier.deposit_datetime)
end
remove_column :dossiers, :deposit_datetime, :datetime
end
end

View file

@ -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: 20170215142944) do ActiveRecord::Schema.define(version: 20170302112312) 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"
@ -24,8 +24,8 @@ ActiveRecord::Schema.define(version: 20170215142944) do
t.integer "sign_in_count", default: 0, null: false t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at" t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at" t.datetime "last_sign_in_at"
t.inet "current_sign_in_ip" t.string "current_sign_in_ip"
t.inet "last_sign_in_ip" t.string "last_sign_in_ip"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.string "api_token" t.string "api_token"
@ -50,8 +50,8 @@ ActiveRecord::Schema.define(version: 20170215142944) do
t.integer "sign_in_count", default: 0, null: false t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at" t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at" t.datetime "last_sign_in_at"
t.inet "current_sign_in_ip" t.string "current_sign_in_ip"
t.inet "last_sign_in_ip" t.string "last_sign_in_ip"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.index ["email"], name: "index_administrations_on_email", unique: true, using: :btree t.index ["email"], name: "index_administrations_on_email", unique: true, using: :btree
@ -126,7 +126,9 @@ ActiveRecord::Schema.define(version: 20170215142944) 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 "deposit_datetime" t.datetime "initiated_at"
t.datetime "received_at"
t.datetime "processed_at"
t.index ["procedure_id"], name: "index_dossiers_on_procedure_id", using: :btree t.index ["procedure_id"], name: "index_dossiers_on_procedure_id", using: :btree
t.index ["user_id"], name: "index_dossiers_on_user_id", using: :btree t.index ["user_id"], name: "index_dossiers_on_user_id", using: :btree
end end
@ -207,8 +209,8 @@ ActiveRecord::Schema.define(version: 20170215142944) do
t.integer "sign_in_count", default: 0, null: false t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at" t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at" t.datetime "last_sign_in_at"
t.inet "current_sign_in_ip" t.string "current_sign_in_ip"
t.inet "last_sign_in_ip" t.string "last_sign_in_ip"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.integer "procedure_filter" t.integer "procedure_filter"
@ -375,8 +377,8 @@ ActiveRecord::Schema.define(version: 20170215142944) do
t.integer "sign_in_count", default: 0, null: false t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at" t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at" t.datetime "last_sign_in_at"
t.inet "current_sign_in_ip" t.string "current_sign_in_ip"
t.inet "last_sign_in_ip" t.string "last_sign_in_ip"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.string "siret" t.string "siret"

View file

@ -52,7 +52,9 @@ describe API::V1::DossiersController do
describe 'dossier' do describe 'dossier' do
subject { super().first } subject { super().first }
it { expect(subject[:id]).to eq(dossier.id) } it { expect(subject[:id]).to eq(dossier.id) }
if ENV['PG'] == 'true'
it { expect(subject[:updated_at]).to eq("2008-09-01T08:05:00.000Z") } it { expect(subject[:updated_at]).to eq("2008-09-01T08:05:00.000Z") }
end
it { expect(subject.keys.size).to eq(2) } it { expect(subject.keys.size).to eq(2) }
end end
end end
@ -124,8 +126,10 @@ describe API::V1::DossiersController do
it { expect(subject[:id]).to eq(dossier.id) } it { expect(subject[:id]).to eq(dossier.id) }
it { expect(subject[:state]).to eq(dossier.state) } it { expect(subject[:state]).to eq(dossier.state) }
if ENV['PG'] == 'true'
it { expect(subject[:created_at]).to eq('2008-09-01T08:05:00.000Z') } it { expect(subject[:created_at]).to eq('2008-09-01T08:05:00.000Z') }
it { expect(subject[:updated_at]).to eq('2008-09-01T08:05:00.000Z') } it { expect(subject[:updated_at]).to eq('2008-09-01T08:05:00.000Z') }
end
it { expect(subject[:archived]).to eq(dossier.archived) } it { expect(subject[:archived]).to eq(dossier.archived) }
it { expect(subject[:mandataire_social]).to eq(dossier.mandataire_social) } it { expect(subject[:mandataire_social]).to eq(dossier.mandataire_social) }

View file

@ -3,6 +3,8 @@ require 'spec_helper'
describe Backoffice::Dossiers::ProcedureController, type: :controller do describe Backoffice::Dossiers::ProcedureController, type: :controller do
let(:gestionnaire) { create :gestionnaire } let(:gestionnaire) { create :gestionnaire }
let(:procedure) { create :procedure } let(:procedure) { create :procedure }
let(:archived) { false }
let(:dossier) { create :dossier, procedure: procedure, archived: archived, state: 'initiated'}
before do before do
create :assign_to, gestionnaire: gestionnaire, procedure: procedure create :assign_to, gestionnaire: gestionnaire, procedure: procedure
@ -28,6 +30,24 @@ describe Backoffice::Dossiers::ProcedureController, type: :controller do
it { is_expected.to redirect_to backoffice_dossiers_path } it { is_expected.to redirect_to backoffice_dossiers_path }
it { expect(flash[:alert]).to be_present} it { expect(flash[:alert]).to be_present}
end end
context 'when procedure contains a dossier' do
render_views
before do
dossier
subject
end
it { expect(response.body).to have_content('Tous les dossiers 1 dossier') }
context 'archived' do
let(:archived) { true }
it { expect(response.body).to have_content('Tous les dossiers 0 dossiers') }
it { expect(response.body).to have_content('Dossiers archivés 1 dossier') }
end
end
end end
describe 'GET #filter' do describe 'GET #filter' do

View file

@ -104,12 +104,6 @@ describe Backoffice::DossiersController, type: :controller do
end end
end end
context ' when dossier is archived' do
let(:dossier_id) { dossier_archived }
it { expect(subject).to redirect_to('/backoffice') }
end
context 'when dossier id does not exist' do context 'when dossier id does not exist' do
let(:dossier_id) { bad_dossier_id } let(:dossier_id) { bad_dossier_id }
@ -174,6 +168,8 @@ describe Backoffice::DossiersController, type: :controller do
end end
end end
if ENV['PG'] == 'true'
describe 'POST #search' do describe 'POST #search' do
describe 'by id' do describe 'by id' do
context 'when I am logged as a gestionnaire' do context 'when I am logged as a gestionnaire' do
@ -212,35 +208,11 @@ describe Backoffice::DossiersController, type: :controller do
end end
end end
end end
describe 'POST #valid' do
before do
dossier.initiated!
sign_in gestionnaire
end
subject { post :valid, params: {dossier_id: dossier_id} }
it 'change state to validated' do
subject
dossier.reload
expect(dossier.state).to eq('validated')
end
it 'Notification email is send' do
expect(NotificationMailer).to receive(:dossier_validated).and_return(NotificationMailer)
expect(NotificationMailer).to receive(:deliver_now!)
subject
end
it { is_expected.to redirect_to backoffice_dossier_path(id: dossier.id) }
end end
describe 'POST #receive' do describe 'POST #receive' do
before do before do
dossier.submitted! dossier.initiated!
sign_in gestionnaire sign_in gestionnaire
end end
@ -382,6 +354,23 @@ describe Backoffice::DossiersController, type: :controller do
end end
end end
describe 'POST #reopen' do
before do
dossier.received!
sign_in gestionnaire
end
subject { post :reopen, params: {dossier_id: dossier_id} }
it 'change state to replied' do
subject
dossier.reload
expect(dossier.state).to eq('replied')
end
it { is_expected.to redirect_to backoffice_dossiers_path }
end
describe 'POST #archive' do describe 'POST #archive' do
before do before do
@ -389,7 +378,7 @@ describe Backoffice::DossiersController, type: :controller do
sign_in gestionnaire sign_in gestionnaire
end end
subject { post :archive, params: {dossier_id: dossier_id} } subject { post :archive, params: {id: dossier_id} }
it 'change state to archived' do it 'change state to archived' do
subject subject

View file

@ -4,7 +4,7 @@ shared_examples 'carte_controller_spec' do
context 'when dossiers procedure have api carto actived' do context 'when dossiers procedure have api carto actived' do
context 'when dossier does not have a valid state' do context 'when dossier does not have a valid state' do
before do before do
dossier.state = 'validated' dossier.state = 'received'
dossier.save dossier.save
get :show, params: {dossier_id: dossier.id} get :show, params: {dossier_id: dossier.id}
@ -164,7 +164,7 @@ shared_examples 'carte_controller_spec' do
subject { Cadastre.last } subject { Cadastre.last }
it { expect(subject.surface_intersection).to eq('0.0006') } it { expect(subject.surface_intersection).to eq('0.0006') }
it { expect(subject.surface_parcelle).to eq(11252.6925830903) } it { expect(subject.surface_parcelle).to eq(11252.692583090324) }
it { expect(subject.numero).to eq('0013') } it { expect(subject.numero).to eq('0013') }
it { expect(subject.feuille).to eq(1) } it { expect(subject.feuille).to eq(1) }
it { expect(subject.section).to eq('CD') } it { expect(subject.section).to eq('CD') }

View file

@ -17,12 +17,27 @@ shared_examples 'description_controller_spec' do
context 'when all is ok' do context 'when all is ok' do
before do before do
dossier.entreprise = create :entreprise dossier.entreprise = create :entreprise
get :show, params: {dossier_id: dossier_id}
end end
it 'returns http success' do it 'returns http success' do
get :show, params: {dossier_id: dossier_id}
expect(response).to have_http_status(:success) expect(response).to have_http_status(:success)
end end
context 'procedure is archived' do
render_views
let(:archived) { true }
it { expect(response).to have_http_status(:success) }
it { expect(response.body).to_not have_content(I18n.t('errors.messages.procedure_archived')) }
context 'dossier is a draft' do
let(:state) { 'draft' }
it { expect(response).to have_http_status(:success) }
it { expect(response.body).to have_content(I18n.t('errors.messages.procedure_archived')) }
end
end
end end
it 'redirection vers start si mauvais dossier ID' do it 'redirection vers start si mauvais dossier ID' do
@ -37,7 +52,7 @@ shared_examples 'description_controller_spec' do
describe 'before_action authorized_routes?' do describe 'before_action authorized_routes?' do
context 'when dossier does not have a valid state' do context 'when dossier does not have a valid state' do
before do before do
dossier.state = 'validated' dossier.state = 'received'
dossier.save dossier.save
get :show, params: {dossier_id: dossier.id} get :show, params: {dossier_id: dossier.id}
@ -90,7 +105,7 @@ shared_examples 'description_controller_spec' do
end end
end end
describe 'POST #create' do describe 'POST #update' do
let(:timestamp) { Time.now } let(:timestamp) { Time.now }
let(:description) { 'Description de test Coucou, je suis un saut à la ligne Je suis un double saut la ligne.' } let(:description) { 'Description de test Coucou, je suis un saut à la ligne Je suis un double saut la ligne.' }
@ -98,7 +113,7 @@ shared_examples 'description_controller_spec' do
describe 'Premier enregistrement des données' do describe 'Premier enregistrement des données' do
let(:submit) { {nouveaux: 'nouveaux'} } let(:submit) { {nouveaux: 'nouveaux'} }
subject { post :create, params: {dossier_id: dossier_id, submit: submit} } subject { post :update, params: {dossier_id: dossier_id, submit: submit} }
before do before do
dossier.draft! dossier.draft!
@ -130,7 +145,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.initiated!
post :create, params: {dossier_id: dossier_id} post :update, params: {dossier_id: dossier_id}
dossier.reload dossier.reload
end end
@ -145,7 +160,7 @@ shared_examples 'description_controller_spec' do
end end
context 'Quand la procédure accepte les CERFA' do context 'Quand la procédure accepte les CERFA' do
subject { post :create, params: {dossier_id: dossier_id, subject { post :update, params: {dossier_id: dossier_id,
cerfa_pdf: cerfa_pdf} } cerfa_pdf: cerfa_pdf} }
it 'Notification interne is create' do it 'Notification interne is create' do
@ -154,7 +169,7 @@ shared_examples 'description_controller_spec' do
context 'Sauvegarde du CERFA PDF', vcr: {cassette_name: 'controllers_users_description_controller_save_cerfa'} do context 'Sauvegarde du CERFA PDF', vcr: {cassette_name: 'controllers_users_description_controller_save_cerfa'} do
before do before do
post :create, params: {dossier_id: dossier_id, post :update, params: {dossier_id: dossier_id,
cerfa_pdf: cerfa_pdf} cerfa_pdf: cerfa_pdf}
dossier.reload dossier.reload
end end
@ -181,7 +196,7 @@ shared_examples 'description_controller_spec' do
let(:cerfas) { Cerfa.where(dossier_id: dossier_id) } let(:cerfas) { Cerfa.where(dossier_id: dossier_id) }
before do before do
post :create, params: {dossier_id: dossier_id, cerfa_pdf: cerfa_pdf} post :update, params: {dossier_id: dossier_id, cerfa_pdf: cerfa_pdf}
end end
it "il y a deux CERFA PDF pour ce dossier" do it "il y a deux CERFA PDF pour ce dossier" do
@ -195,7 +210,7 @@ shared_examples 'description_controller_spec' do
context 'Sauvegarde du CERFA PDF' do context 'Sauvegarde du CERFA PDF' do
let!(:procedure) { create(:procedure) } let!(:procedure) { create(:procedure) }
before do before do
post :create, params: {dossier_id: dossier_id, post :update, params: {dossier_id: dossier_id,
cerfa_pdf: cerfa_pdf} cerfa_pdf: cerfa_pdf}
dossier.reload dossier.reload
end end
@ -214,7 +229,7 @@ shared_examples 'description_controller_spec' do
let(:dossier_minute_value) { '00' } let(:dossier_minute_value) { '00' }
before do before do
post :create, params: {dossier_id: dossier_id, post :update, params: {dossier_id: dossier_id,
champs: { champs: {
"'#{dossier.champs.first.id}'" => dossier_champs_first, "'#{dossier.champs.first.id}'" => dossier_champs_first,
"'#{dossier.champs.second.id}'" => dossier_date_value "'#{dossier.champs.second.id}'" => dossier_date_value
@ -254,7 +269,7 @@ shared_examples 'description_controller_spec' do
context 'Sauvegarde des pièces justificatives', vcr: {cassette_name: 'controllers_users_description_controller_sauvegarde_pj'} do context 'Sauvegarde des pièces justificatives', vcr: {cassette_name: 'controllers_users_description_controller_sauvegarde_pj'} do
let(:all_pj_type) { dossier.procedure.type_de_piece_justificative_ids } let(:all_pj_type) { dossier.procedure.type_de_piece_justificative_ids }
before do before do
post :create, params: {dossier_id: dossier_id, post :update, params: {dossier_id: dossier_id,
'piece_justificative_'+all_pj_type[0].to_s => piece_justificative_0, 'piece_justificative_'+all_pj_type[0].to_s => piece_justificative_0,
'piece_justificative_'+all_pj_type[1].to_s => piece_justificative_1} 'piece_justificative_'+all_pj_type[1].to_s => piece_justificative_1}
dossier.reload dossier.reload
@ -264,7 +279,7 @@ shared_examples 'description_controller_spec' do
it 'ClamavService safe_file? is call' do it 'ClamavService safe_file? is call' do
expect(ClamavService).to receive(:safe_file?).twice expect(ClamavService).to receive(:safe_file?).twice
post :create, params: {dossier_id: dossier_id, post :update, params: {dossier_id: dossier_id,
'piece_justificative_'+all_pj_type[0].to_s => piece_justificative_0, 'piece_justificative_'+all_pj_type[0].to_s => piece_justificative_0,
'piece_justificative_'+all_pj_type[1].to_s => piece_justificative_1} 'piece_justificative_'+all_pj_type[1].to_s => piece_justificative_1}
end end
@ -281,6 +296,22 @@ shared_examples 'description_controller_spec' do
it { expect(subject.user).to eq user } it { expect(subject.user).to eq user }
end end
end end
context 'La procédure est archivée' do
let(:archived) { true }
before do
post :update, params: { dossier_id: dossier.id }
end
it { expect(response.status).to eq(302) }
context 'Le dossier est en brouillon' do
let(:state) { 'draft' }
it { expect(response.status).to eq(403) }
end
end
end end
describe 'POST #pieces_justificatives', vcr: {cassette_name: 'controllers_users_description_controller_pieces_justificatives'} do describe 'POST #pieces_justificatives', vcr: {cassette_name: 'controllers_users_description_controller_pieces_justificatives'} do

View file

@ -5,9 +5,11 @@ require 'controllers/users/description_controller_shared_example'
describe Users::DescriptionController, type: :controller, vcr: {cassette_name: 'controllers_users_description_controller'} do describe Users::DescriptionController, type: :controller, vcr: {cassette_name: 'controllers_users_description_controller'} do
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) { false }
let(:state) { 'initiated' }
let(:procedure) { create(:procedure, :with_two_type_de_piece_justificative, :with_type_de_champ, :with_datetime, cerfa_flag: true) } let(:procedure) { create(:procedure, :with_two_type_de_piece_justificative, :with_type_de_champ, :with_datetime, cerfa_flag: true, archived: archived) }
let(:dossier) { create(:dossier, procedure: procedure, user: owner_user, state: 'initiated') } let(:dossier) { create(:dossier, procedure: procedure, user: owner_user, state: state) }
let(:dossier_id) { dossier.id } let(:dossier_id) { dossier.id }
let(:bad_dossier_id) { Dossier.count + 10000 } let(:bad_dossier_id) { Dossier.count + 10000 }

View file

@ -39,7 +39,7 @@ describe Users::DossiersController, type: :controller do
describe 'before_action authorized_routes?' do describe 'before_action authorized_routes?' do
context 'when dossier does not have a valid state' do context 'when dossier does not have a valid state' do
before do before do
dossier.state = 'validated' dossier.state = 'received'
dossier.save dossier.save
get :show, params: {id: dossier.id} get :show, params: {id: dossier.id}
@ -307,13 +307,17 @@ describe Users::DossiersController, type: :controller do
describe "with siret without whitespaces" do describe "with siret without whitespaces" do
let(:example_siret) { siret } let(:example_siret) { siret }
if ENV['CIRCLECI'].nil?
it_should_behave_like "with valid siret" it_should_behave_like "with valid siret"
end end
end
describe "with siret with whitespaces" do describe "with siret with whitespaces" do
let(:example_siret) { siret_with_whitespaces } let(:example_siret) { siret_with_whitespaces }
if ENV['CIRCLECI'].nil?
it_should_behave_like "with valid siret" it_should_behave_like "with valid siret"
end end
end
context 'with non existant siret' do context 'with non existant siret' do
before do before do
@ -485,19 +489,6 @@ describe Users::DossiersController, type: :controller do
end end
end end
describe 'GET #valides' do
context 'when user is connected' do
before do
sign_in user
end
it 'returns http success' do
get :index, params: {liste: :valides}
expect(response).to have_http_status(200)
end
end
end
describe 'GET #en_instruction' do describe 'GET #en_instruction' do
context 'when user is connected' do context 'when user is connected' do
before do before do

View file

@ -52,40 +52,4 @@ describe Users::RecapitulatifController, type: :controller do
end end
end end
end end
describe 'POST #submit' do
context 'when an user depose his dossier' do
let(:deposit_datetime) { Time.local(2016, 8, 1, 10, 5, 0) }
before do
dossier.validated!
Timecop.freeze(deposit_datetime) { post :submit, params: {dossier_id: dossier.id} }
dossier.reload
end
it 'dossier change his state for submitted' do
expect(dossier.state).to eq('submitted')
end
it 'dossier deposit datetime is filled' do
expect(dossier.deposit_datetime).to eq deposit_datetime
end
it 'a message informe user what his dossier is initiated' do
expect(flash[:notice]).to include('Dossier déposé avec succès.')
end
it 'Notification email is send' do
expect(NotificationMailer).to receive(:dossier_submitted).and_return(NotificationMailer)
expect(NotificationMailer).to receive(:deliver_now!)
dossier.validated!
post :submit, params: {dossier_id: dossier.id}
end
it 'Internal notification is created' do
expect(Notification.where(dossier_id: dossier.id, type_notif: 'submitted').first).not_to be_nil
end
end
end
end end

View file

@ -11,7 +11,7 @@ shared_examples 'current_user_dossier_spec' do
end end
context 'when dossier id is incorrect' do context 'when dossier id is incorrect' do
it { expect { subject.current_user_dossier 1 }.to raise_error ActiveRecord::RecordNotFound } it { expect { subject.current_user_dossier 666 }.to raise_error ActiveRecord::RecordNotFound }
end end
end end

View file

@ -24,7 +24,7 @@ describe DossierDecorator do
it 'initiated is initiate' do it 'initiated is initiate' do
dossier.initiated! dossier.initiated!
expect(subject).to eq('Nouveau') expect(subject).to eq('En construction')
end end
it 'replied is repondu' do it 'replied is repondu' do
@ -37,16 +37,6 @@ describe DossierDecorator do
expect(subject).to eq('En construction') expect(subject).to eq('En construction')
end end
it 'validated is valide' do
dossier.validated!
expect(subject).to eq('Figé')
end
it 'submitted is dépose' do
dossier.submitted!
expect(subject).to eq('Déposé / À réceptionner')
end
it 'closed is traité' do it 'closed is traité' do
dossier.closed! dossier.closed!
expect(subject).to eq('Accepté') expect(subject).to eq('Accepté')

View file

@ -7,10 +7,6 @@ describe MailTemplateDecorator do
context '#name' do context '#name' do
subject { decorator.name } subject { decorator.name }
context 'when mail_template is a MailValidated' do
it { is_expected.to eq "E-mail de validation" }
end
context 'when mail_template is a MailReceived' do context 'when mail_template is a MailReceived' do
let(:mail_template) {create :mail_template, :dossier_received} let(:mail_template) {create :mail_template, :dossier_received}
it { is_expected.to eq "E-mail d'accusé de réception" } it { is_expected.to eq "E-mail d'accusé de réception" }

View file

@ -5,10 +5,7 @@ describe AdminProceduresShowFacades do
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: 'initiated') }
let!(:dossier_2) { create(:dossier, procedure: procedure, state: 'validated') } let!(:dossier_2) { create(:dossier, procedure: procedure, state: 'replied') }
let!(:dossier_3) { create(:dossier, procedure: procedure, state: 'validated') }
let!(:dossier_4) { create(:dossier, procedure: procedure, archived: true, state: 'validated') }
let!(:dossier_5) { create(:dossier, procedure: procedure, archived: true, state: 'validated') }
let!(:dossier_6) { create(:dossier, procedure: procedure, archived: true, state: 'initiated') } let!(:dossier_6) { create(:dossier, procedure: procedure, archived: true, state: 'initiated') }
let!(:dossier_7) { create(:dossier, procedure: procedure, state: 'updated') } let!(:dossier_7) { create(:dossier, procedure: procedure, state: 'updated') }
@ -23,37 +20,34 @@ describe AdminProceduresShowFacades do
describe '.dossiers' do describe '.dossiers' do
subject { super().dossiers } subject { super().dossiers }
it { expect(subject.size).to eq(7) } it { expect(subject.size).to eq(4) }
end end
describe '.dossiers_for_pie_highchart' do describe '.dossiers_for_pie_highchart' do
subject { super().dossiers_for_pie_highchart } subject { super().dossiers_for_pie_highchart }
it { expect(subject).to eq({'Nouveau' => 1, 'Figé' => 2, "En construction"=>1}) } it { expect(subject).to eq({ 'En construction' => 3 }) }
end end
describe '.dossiers_archived_by_state_total' do describe '.dossiers_archived_by_state_total' do
subject { super().dossiers_archived_by_state_total } subject { super().dossiers_archived_by_state_total }
it { expect(subject.size).to eq(2) } it { expect(subject.size).to eq(1) }
it { expect(subject.first.state).to eq('initiated') } it { expect(subject.first.state).to eq('initiated') }
it { expect(subject.first.total).to eq(1) } it { expect(subject.first.total).to eq(1) }
it { expect(subject.last.state).to eq('validated') }
it { expect(subject.last.total).to eq(2) }
end end
describe 'dossiers_archived_total' do describe 'dossiers_archived_total' do
subject { super().dossiers_archived_total } subject { super().dossiers_archived_total }
it { is_expected.to eq(3) } it { is_expected.to eq(1) }
end end
describe 'dossiers_total' do describe 'dossiers_total' do
subject { super().dossiers_total } subject { super().dossiers_total }
it { is_expected.to eq(7) } it { is_expected.to eq(4) }
end end
describe 'dossiers_waiting_gestionnaire_total' do describe 'dossiers_waiting_gestionnaire_total' do
@ -65,7 +59,7 @@ describe AdminProceduresShowFacades do
describe 'dossiers_waiting_user_total' do describe 'dossiers_waiting_user_total' do
subject { super().dossiers_waiting_user_total } subject { super().dossiers_waiting_user_total }
it { is_expected.to eq(2) } it { is_expected.to eq(1) }
end end
describe 'dossiers_termine_total' do describe 'dossiers_termine_total' do

View file

@ -10,10 +10,10 @@ feature 'As an Accompagnateur I can navigate and use each functionnality around
create :assign_to, gestionnaire: gestionnaire, procedure: procedure_1 create :assign_to, gestionnaire: gestionnaire, procedure: procedure_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: 'validated') Dossier.create(procedure_id: procedure_1.id.to_s, user: user, state: 'initiated')
end end
22.times do 22.times do
Dossier.create(procedure_id: procedure_2.id.to_s, user: user, state: 'validated') Dossier.create(procedure_id: procedure_2.id.to_s, user: user, state: 'received')
end end
login_as gestionnaire, scope: :gestionnaire login_as gestionnaire, scope: :gestionnaire
visit backoffice_path visit backoffice_path
@ -53,15 +53,15 @@ feature 'As an Accompagnateur I can navigate and use each functionnality around
expect(page.all("#all_state_dossiers .dossier-row")[0]['id']).to eq("tr_dossier_#{procedure_1.dossiers.first.id}") expect(page.all("#all_state_dossiers .dossier-row")[0]['id']).to eq("tr_dossier_#{procedure_1.dossiers.first.id}")
visit "/backoffice/dossiers/procedure/#{procedure_1.id}?all_state_dossiers_smart_listing[sort][id]=desc" visit "/backoffice/dossiers/procedure/#{procedure_1.id}?all_state_dossiers_smart_listing[sort][id]=desc"
wait_for_ajax wait_for_ajax
expect(page.all(".dossier-row")[0]['id']).to eq("tr_dossier_#{procedure_1.dossiers.last.id}") expect(page.all("#all_dossiers .dossier-row")[0]['id']).to eq("tr_dossier_#{procedure_1.dossiers.last.id}")
page.find('#all_state_dossiers .next_page a').trigger('click') page.find('#all_state_dossiers .next_page a').trigger('click')
wait_for_ajax wait_for_ajax
page.find('#all_state_dossiers .next_page a').trigger('click') page.find('#all_state_dossiers .next_page a').trigger('click')
wait_for_ajax wait_for_ajax
expect(page.all(".dossier-row")[0]['id']).to eq("tr_dossier_#{procedure_1.dossiers.first.id + 9}") expect(page.all("#all_dossiers .dossier-row")[0]['id']).to eq("tr_dossier_#{procedure_1.dossiers.first.id + 9}")
page.find('#all_state_dossiers .prev a').trigger('click') page.find('#all_state_dossiers .prev a').trigger('click')
wait_for_ajax wait_for_ajax
expect(page.all(".dossier-row")[0]['id']).to eq("tr_dossier_#{procedure_1.dossiers.first.id + 19}") expect(page.all("#all_dossiers .dossier-row")[0]['id']).to eq("tr_dossier_#{procedure_1.dossiers.first.id + 19}")
end end
scenario 'Using filter' do scenario 'Using filter' do
@ -79,7 +79,7 @@ feature 'As an Accompagnateur I can navigate and use each functionnality around
expect(page.all('#follow_dossiers .count').first.text).to eq('0 dossiers') expect(page.all('#follow_dossiers .count').first.text).to eq('0 dossiers')
visit "/backoffice/dossiers/procedure/#{procedure_1.id}?all_state_dossiers_smart_listing[sort][id]=asc" visit "/backoffice/dossiers/procedure/#{procedure_1.id}?all_state_dossiers_smart_listing[sort][id]=asc"
page.find_by_id("suivre_dossier_#{procedure_1.dossiers.first.id}").click page.find("#all_dossiers #suivre_dossier_#{procedure_1.dossiers.first.id}").click
visit "/backoffice/dossiers/#{procedure_1.dossiers.second.id}" visit "/backoffice/dossiers/#{procedure_1.dossiers.second.id}"
page.find_by_id("suivre_dossier_#{procedure_1.dossiers.second.id}").click page.find_by_id("suivre_dossier_#{procedure_1.dossiers.second.id}").click
@ -88,8 +88,9 @@ feature 'As an Accompagnateur I can navigate and use each functionnality around
expect(page.all('#follow_dossiers .count').first.text).to eq('2 dossiers') expect(page.all('#follow_dossiers .count').first.text).to eq('2 dossiers')
end end
if ENV['CIRCLECI'].nil?
scenario 'Adding message', js: true do scenario 'Adding message', js: true do
page.find_by_id("tr_dossier_#{procedure_1.dossiers.first.id}").trigger('click') page.find("#all_dossiers #tr_dossier_#{procedure_1.dossiers.first.id}").trigger('click')
expect(page).to have_current_path(backoffice_dossier_path(procedure_1.dossiers.first.id), only_path: true) expect(page).to have_current_path(backoffice_dossier_path(procedure_1.dossiers.first.id), only_path: true)
page.find_by_id('open-message').click page.find_by_id('open-message').click
page.execute_script("$('#texte_commentaire').data('wysihtml5').editor.setValue('Contenu du nouveau message')") page.execute_script("$('#texte_commentaire').data('wysihtml5').editor.setValue('Contenu du nouveau message')")
@ -98,3 +99,4 @@ feature 'As an Accompagnateur I can navigate and use each functionnality around
end end
end end
end end
end

View file

@ -1,5 +1,6 @@
require 'spec_helper' require 'spec_helper'
if ENV['PG'] == 'true'
feature 'search file on gestionnaire backoffice' do feature 'search file on gestionnaire backoffice' do
let(:administrateur) { create(:administrateur) } let(:administrateur) { create(:administrateur) }
let(:gestionnaire) { create(:gestionnaire, administrateurs: [administrateur]) } let(:gestionnaire) { create(:gestionnaire, administrateurs: [administrateur]) }
@ -50,3 +51,4 @@ feature 'search file on gestionnaire backoffice' do
end end
end end
end end
end

View file

@ -17,7 +17,6 @@ feature 'As a User I want to edit a dossier I own' do
expect(page.find('#a_traiter')['class'] ).to eq('active procedure_list_element') expect(page.find('#a_traiter')['class'] ).to eq('active procedure_list_element')
page.find_by_id('brouillon').click page.find_by_id('brouillon').click
page.find_by_id('a_traiter').click page.find_by_id('a_traiter').click
page.find_by_id('valides').click
page.find_by_id('en_instruction').click page.find_by_id('en_instruction').click
page.find_by_id('termine').click page.find_by_id('termine').click
page.find_by_id('invite').click page.find_by_id('invite').click

View file

@ -1,6 +1,6 @@
require 'spec_helper' require 'spec_helper'
feature 'As a User I want to sort and paginate dossiers', js: true do xfeature 'As a User I want to sort and paginate dossiers', js: true do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:procedure_for_individual) { create(:procedure, :published, :for_individual) } let(:procedure_for_individual) { create(:procedure, :published, :for_individual) }

View file

@ -9,8 +9,6 @@ feature 'on click on tabs button' do
create(:dossier, :with_entreprise, user: user, state: 'initiated') create(:dossier, :with_entreprise, user: user, state: 'initiated')
create(:dossier, :with_entreprise, user: user, state: 'replied') create(:dossier, :with_entreprise, user: user, state: 'replied')
create(:dossier, :with_entreprise, user: user, state: 'updated') create(:dossier, :with_entreprise, user: user, state: 'updated')
create(:dossier, :with_entreprise, user: user, state: 'validated')
create(:dossier, :with_entreprise, user: user, state: 'submitted')
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')
@ -33,21 +31,10 @@ feature 'on click on tabs button' do
end end
end end
context 'when he click on tabs a deposes' do
before do
visit users_dossiers_url(liste: :valides)
page.click_on 'À déposer 1'
end
scenario 'it redirect to users dossier deposes' do
expect(page).to have_css('#users_index')
end
end
context 'when he click on tabs en examen' do context 'when he click on tabs en examen' do
before do before do
visit users_dossiers_url(liste: :en_instruction) visit users_dossiers_url(liste: :en_instruction)
page.click_on 'En examen 2' page.click_on 'En instruction 1'
end end
scenario 'it redirect to users dossier termine' do scenario 'it redirect to users dossier termine' do
@ -58,7 +45,7 @@ feature 'on click on tabs button' do
context 'when he click on tabs termine' do context 'when he click on tabs termine' do
before do before do
visit users_dossiers_url(liste: :termine) visit users_dossiers_url(liste: :termine)
page.click_on 'Cloturé 3' page.click_on 'Terminé 3'
end end
scenario 'it redirect to users dossier termine' do scenario 'it redirect to users dossier termine' do

View file

@ -3,9 +3,11 @@ require 'spec_helper'
describe Carto::Geocodeur do describe Carto::Geocodeur do
let(:address) { '50 av des champs elysees' } let(:address) { '50 av des champs elysees' }
describe '.convert_adresse_to_point', vcr: { cassette_name: 'bano_octo' } do describe '.convert_adresse_to_point', vcr: { cassette_name: 'bano_octo' } do
if ENV['CIRCLECI'].nil?
it 'return a point' do it 'return a point' do
expect(described_class.convert_adresse_to_point(address).class).to eq(RGeo::Cartesian::PointImpl) expect(described_class.convert_adresse_to_point(address).class).to eq(RGeo::Cartesian::PointImpl)
end end
end
context 'when RestClient::Exception' do context 'when RestClient::Exception' do
before do before do
allow_any_instance_of(Carto::Bano::Driver).to receive(:call).and_raise(RestClient::Exception) allow_any_instance_of(Carto::Bano::Driver).to receive(:call).and_raise(RestClient::Exception)

View file

@ -12,19 +12,6 @@ RSpec.describe NotificationMailer, type: :mailer do
it { expect(subject.subject).to eq("Nouveau message pour votre dossier TPS N°#{dossier.id}") } it { expect(subject.subject).to eq("Nouveau message pour votre dossier TPS N°#{dossier.id}") }
end end
describe ".dossier_validated" do
let(:user) { create(:user) }
let(:dossier) { create(:dossier, user: user) }
subject(:subject) { described_class.dossier_validated(dossier) }
before { dossier.reload }
it { expect(subject.body).to match("Votre dossier N°#{dossier.id} est prêt à être déposé pour instruction.") }
it { expect(subject.body).to include("Afin de finaliser son dépôt, merci de vous rendre sur", users_dossier_recapitulatif_url(dossier_id: dossier.id)) }
it { expect(subject.subject).to eq("[TPS] Votre dossier TPS N°#{dossier.id} a été validé") }
end
describe ".dossier_submitted" do describe ".dossier_submitted" do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:dossier) { create(:dossier, user: user) } let(:dossier) { create(:dossier, user: user) }

View file

@ -4,8 +4,4 @@ class NotificationMailerPreview < ActionMailer::Preview
NotificationMailer.dossier_received(Dossier.last) NotificationMailer.dossier_received(Dossier.last)
end end
def dossier_validated
NotificationMailer.dossier_validated(Dossier.last)
end
end end

View file

@ -224,12 +224,6 @@ describe Dossier do
it { is_expected.to eq 'updated' } it { is_expected.to eq 'updated' }
end end
context 'when is validated the dossier' do
let(:action) { 'valid' }
it { is_expected.to eq('validated') }
end
end end
end end
@ -269,11 +263,6 @@ describe Dossier do
it { is_expected.to eq 'replied' } it { is_expected.to eq 'replied' }
end end
context 'when is validated the dossier' do
let(:action) { 'valid' }
it { is_expected.to eq('validated') }
end
end end
end end
@ -307,74 +296,6 @@ describe Dossier do
it { is_expected.to eq('replied') } it { is_expected.to eq('replied') }
end end
context 'when is validated the dossier' do
let(:action) { 'valid' }
it { is_expected.to eq('validated') }
end
end
end
context 'when dossier is at state validated' do
before do
dossier.validated!
end
context 'when user is connect' do
let(:role) { 'user' }
context 'when is post a comment' do
let(:action) { 'comment' }
it { is_expected.to eq('validated') }
end
context 'when is submitted the dossier' do
let(:action) { 'submit' }
it { is_expected.to eq('submitted') }
end
end
context 'when gestionnaire is connect' do
let(:role) { 'gestionnaire' }
context 'when is post a comment' do
let(:action) { 'comment' }
it { is_expected.to eq('validated') }
end
end
end
context 'when dossier is at state submitted' do
before do
dossier.submitted!
end
context 'when user is connected' do
let(:role) { 'user' }
context 'when he posts a comment' do
let(:action) { 'comment' }
it { is_expected.to eq('submitted') }
end
end
context 'when gestionnaire is connect' do
let(:role) { 'gestionnaire' }
context 'when he posts a comment' do
let(:action) { 'comment' }
it { is_expected.to eq('submitted') }
end
context 'when he receive the dossier' do
let(:action) { 'receive' }
it { is_expected.to eq('received') }
end
end end
end end
@ -505,14 +426,11 @@ describe Dossier do
create(:dossier, procedure: procedure_admin, state: 'initiated') #nouveaux create(:dossier, procedure: procedure_admin, state: 'initiated') #nouveaux
create(:dossier, procedure: procedure_admin, state: 'replied') #en_attente create(:dossier, procedure: procedure_admin, state: 'replied') #en_attente
create(:dossier, procedure: procedure_admin, state: 'updated') #a_traiter create(:dossier, procedure: procedure_admin, state: 'updated') #a_traiter
create(:dossier, procedure: procedure_admin, state: 'submitted') #deposes
create(:dossier, procedure: procedure_admin, state: 'received') #a_instruire create(:dossier, procedure: procedure_admin, state: 'received') #a_instruire
create(:dossier, procedure: procedure_admin, state: 'received') #a_instruire create(:dossier, procedure: procedure_admin, state: 'received') #a_instruire
create(:dossier, procedure: procedure_admin, state: 'closed') #termine create(:dossier, procedure: procedure_admin, state: 'closed') #termine
create(:dossier, procedure: procedure_admin, state: 'refused') #termine create(:dossier, procedure: procedure_admin, state: 'refused') #termine
create(:dossier, procedure: procedure_admin, state: 'without_continuation') #termine create(:dossier, procedure: procedure_admin, state: 'without_continuation') #termine
create(:dossier, procedure: procedure_admin_2, state: 'validated') #en_attente
create(:dossier, procedure: procedure_admin_2, state: 'submitted') #deposes
create(:dossier, procedure: procedure_admin_2, state: 'closed') #termine create(:dossier, procedure: procedure_admin_2, state: 'closed') #termine
create(:dossier, procedure: procedure_admin, state: 'initiated', archived: true) #a_traiter #archived create(:dossier, procedure: procedure_admin, state: 'initiated', archived: true) #a_traiter #archived
create(:dossier, procedure: procedure_admin, state: 'replied', archived: true) #en_attente #archived create(:dossier, procedure: procedure_admin, state: 'replied', archived: true) #en_attente #archived
@ -543,12 +461,6 @@ describe Dossier do
it { expect(subject.size).to eq(2) } it { expect(subject.size).to eq(2) }
end end
describe '#deposes' do
subject { gestionnaire.dossiers.deposes }
it { expect(subject.size).to eq(1) }
end
describe '#termine' do describe '#termine' do
subject { gestionnaire.dossiers.termine } subject { gestionnaire.dossiers.termine }
@ -685,7 +597,10 @@ describe Dossier do
let(:procedure) { create(:procedure, :with_type_de_champ) } let(:procedure) { create(:procedure, :with_type_de_champ) }
let(:gestionnaire) { create(:gestionnaire) } let(:gestionnaire) { create(:gestionnaire) }
let(:follow) { create(:follow, gestionnaire: gestionnaire) } let(:follow) { create(:follow, gestionnaire: gestionnaire) }
let(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure, follows: [follow]) } let(:date1) { 1.day.ago }
let(:date2) { 1.hour.ago }
let(:date3) { 1.minute.ago }
let(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure, follows: [follow], initiated_at: date1, received_at: date2, processed_at: date3) }
describe '#export_headers' do describe '#export_headers' do
@ -696,6 +611,7 @@ describe Dossier do
end end
describe '#data_with_champs' do describe '#data_with_champs' do
subject { dossier.data_with_champs } subject { dossier.data_with_champs }
it { expect(subject[0]).to be_a_kind_of(Integer) } it { expect(subject[0]).to be_a_kind_of(Integer) }
@ -704,14 +620,17 @@ describe Dossier do
it { expect(subject[3]).to be_in([true, false]) } it { expect(subject[3]).to be_in([true, false]) }
it { expect(subject[4]).to be_in([true, false]) } it { expect(subject[4]).to be_in([true, false]) }
it { expect(subject[5]).to eq("draft") } it { expect(subject[5]).to eq("draft") }
it { expect(subject[6]).to eq(dossier.followers_gestionnaires_emails) } it { expect(subject[6]).to eq(date1) }
it { expect(subject[7]).to eq(date2) }
it { expect(subject[8]).to eq(date3) }
it { expect(subject[9]).to eq(dossier.followers_gestionnaires_emails) }
it { expect(subject.count).to eq(DossierProcedureSerializer.new(dossier).attributes.count + dossier.procedure.types_de_champ.count + dossier.export_entreprise_data.count) } it { expect(subject.count).to eq(DossierProcedureSerializer.new(dossier).attributes.count + dossier.procedure.types_de_champ.count + dossier.export_entreprise_data.count) }
end end
end end
describe '#Dossier.to_csv' do describe '#Dossier.to_csv' do
let!(:procedure) { create(:procedure) } let!(:procedure) { create(:procedure) }
let!(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure) } let!(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure, ) }
subject do subject do
dossier_hash = {} dossier_hash = {}
@ -969,6 +888,82 @@ describe Dossier do
it { is_expected.to eq "#{gestionnaire.email} #{gestionnaire2.email}" } it { is_expected.to eq "#{gestionnaire.email} #{gestionnaire2.email}" }
end end
end
describe '#update_state_dates' do
let(:state) { 'draft' }
let(:dossier) { create(:dossier, state: state) }
let(:beginning_of_day) { Time.now.beginning_of_day }
before do
Timecop.freeze(beginning_of_day)
end
context 'when dossier is initiated' do
before do
dossier.initiated!
dossier.reload
end
it { expect(dossier.state).to eq('initiated') }
it { expect(dossier.initiated_at).to eq(beginning_of_day) }
it 'should keep first initiated_at date' do
Timecop.return
dossier.received!
dossier.initiated!
expect(dossier.initiated_at).to eq(beginning_of_day)
end
end
context 'when dossier is received' do
let(:state) { 'initiated' }
before do
dossier.received!
dossier.reload
end
it { expect(dossier.state).to eq('received') }
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
Timecop.return
dossier.initiated!
dossier.received!
expect(dossier.received_at).to eq(beginning_of_day)
end
end
shared_examples 'dossier is processed' do |new_state|
before do
dossier.update(state: new_state)
dossier.reload
end
it { expect(dossier.state).to eq(new_state) }
it { expect(dossier.processed_at).to eq(beginning_of_day) }
end
context 'when dossier is closed' do
let(:state) { 'received' }
it_behaves_like 'dossier is processed', 'closed'
end
context 'when dossier is refused' do
let(:state) { 'received' }
it_behaves_like 'dossier is processed', 'refused'
end
context 'when dossier is without_continuation' do
let(:state) { 'received' }
it_behaves_like 'dossier is processed', 'without_continuation'
end
end end
end end

View file

@ -39,7 +39,7 @@ describe MailTemplate do
end end
end end
xdescribe '.replace_tags' do describe '.replace_tags' do
let(:dossier) { create :dossier } let(:dossier) { create :dossier }
let(:procedure) { dossier.procedure } let(:procedure) { dossier.procedure }
let(:mail_received) { procedure.mail_received } let(:mail_received) { procedure.mail_received }

View file

@ -49,10 +49,9 @@ describe Procedure do
subject.reload subject.reload
end end
it { expect(subject.mail_templates.size).to eq 2 } it { expect(subject.mail_templates.size).to eq 1 }
it { expect(subject.mail_received).not_to be_nil } it { expect(subject.mail_received).not_to be_nil }
it { expect(subject.mail_validated).not_to be_nil }
end end
end end

View file

@ -1,5 +1,6 @@
require 'spec_helper' require 'spec_helper'
if ENV['PG'] == 'true'
describe Search do describe Search do
describe '.results' do describe '.results' do
subject { liste_dossiers } subject { liste_dossiers }
@ -77,3 +78,4 @@ describe Search do
end end
end end
end end
end

View file

@ -33,16 +33,6 @@ describe UserRoutesAuthorizationService do
it { is_expected.to be_falsey } it { is_expected.to be_falsey }
end end
describe 'validated' do
let(:state) { 'validated' }
it { is_expected.to be_falsey }
end
describe 'submitted' do
let(:state) { 'submitted' }
it { is_expected.to be_falsey }
end
describe 'closed' do describe 'closed' do
let(:state) { 'closed' } let(:state) { 'closed' }
it { is_expected.to be_falsey } it { is_expected.to be_falsey }
@ -74,16 +64,6 @@ describe UserRoutesAuthorizationService do
it { is_expected.to be_falsey } it { is_expected.to be_falsey }
end end
describe 'validated' do
let(:state) { 'validated' }
it { is_expected.to be_falsey }
end
describe 'submitted' do
let(:state) { 'submitted' }
it { is_expected.to be_falsey }
end
describe 'closed' do describe 'closed' do
let(:state) { 'closed' } let(:state) { 'closed' }
it { is_expected.to be_falsey } it { is_expected.to be_falsey }
@ -113,16 +93,6 @@ describe UserRoutesAuthorizationService do
it { is_expected.to be_truthy } it { is_expected.to be_truthy }
end end
describe 'validated' do
let(:state) { 'validated' }
it { is_expected.to be_falsey }
end
describe 'submitted' do
let(:state) { 'submitted' }
it { is_expected.to be_falsey }
end
describe 'closed' do describe 'closed' do
let(:state) { 'closed' } let(:state) { 'closed' }
it { is_expected.to be_falsey } it { is_expected.to be_falsey }
@ -153,16 +123,6 @@ describe UserRoutesAuthorizationService do
it { is_expected.to be_truthy } it { is_expected.to be_truthy }
end end
describe 'validated' do
let(:state) { 'validated' }
it { is_expected.to be_falsey }
end
describe 'submitted' do
let(:state) { 'submitted' }
it { is_expected.to be_falsey }
end
describe 'closed' do describe 'closed' do
let(:state) { 'closed' } let(:state) { 'closed' }
it { is_expected.to be_falsey } it { is_expected.to be_falsey }
@ -192,16 +152,6 @@ describe UserRoutesAuthorizationService do
it { is_expected.to be_truthy } it { is_expected.to be_truthy }
end end
describe 'validated' do
let(:state) { 'validated' }
it { is_expected.to be_truthy }
end
describe 'submitted' do
let(:state) { 'submitted' }
it { is_expected.to be_truthy }
end
describe 'closed' do describe 'closed' do
let(:state) { 'closed' } let(:state) { 'closed' }
it { is_expected.to be_truthy } it { is_expected.to be_truthy }

View file

@ -9,8 +9,6 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
let!(:decorate_dossier_initiated) { create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated').decorate } let!(:decorate_dossier_initiated) { create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated').decorate }
let!(:decorate_dossier_replied) { create(:dossier, :with_entreprise, procedure: procedure, state: 'replied').decorate } let!(:decorate_dossier_replied) { create(:dossier, :with_entreprise, procedure: procedure, state: 'replied').decorate }
let!(:decorate_dossier_updated) { create(:dossier, :with_entreprise, procedure: procedure, state: 'updated').decorate } let!(:decorate_dossier_updated) { create(:dossier, :with_entreprise, procedure: procedure, state: 'updated').decorate }
let!(:decorate_dossier_validated) { create(:dossier, :with_entreprise, procedure: procedure, state: 'validated').decorate }
let!(:decorate_dossier_submitted) { create(:dossier, :with_entreprise, procedure: procedure, state: 'submitted').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 }
@ -25,8 +23,6 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
before do before do
decorate_dossier_replied.entreprise.update_column(:raison_sociale, 'plap') decorate_dossier_replied.entreprise.update_column(:raison_sociale, 'plap')
decorate_dossier_updated.entreprise.update_column(:raison_sociale, 'plep') decorate_dossier_updated.entreprise.update_column(:raison_sociale, 'plep')
decorate_dossier_validated.entreprise.update_column(:raison_sociale, 'plip')
decorate_dossier_submitted.entreprise.update_column(:raison_sociale, 'plop')
decorate_dossier_received.entreprise.update_column(:raison_sociale, 'plup') decorate_dossier_received.entreprise.update_column(:raison_sociale, 'plup')
decorate_dossier_closed.entreprise.update_column(:raison_sociale, 'plyp') decorate_dossier_closed.entreprise.update_column(:raison_sociale, 'plyp')
decorate_dossier_refused.entreprise.update_column(:raison_sociale, 'plzp') decorate_dossier_refused.entreprise.update_column(:raison_sociale, 'plzp')
@ -81,9 +77,9 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
subject { rendered } subject { rendered }
it { is_expected.to have_content('Nouveaux dossiers 1 dossiers') } it { is_expected.to have_content('Nouveaux dossiers 1 dossier') }
it { is_expected.to have_content('Dossiers suivis 0 dossiers') } it { is_expected.to have_content('Dossiers suivis 0 dossiers') }
it { is_expected.to have_content('Tous les dossiers 9 dossiers') } it { is_expected.to have_content('Tous les dossiers 7 dossiers') }
it { is_expected.to have_content('État') } it { is_expected.to have_content('État') }
it { is_expected.to have_content('Libellé procédure') } it { is_expected.to have_content('Libellé procédure') }
@ -92,8 +88,6 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
it { is_expected.to have_content('plap') } it { is_expected.to have_content('plap') }
it { is_expected.to have_content('plep') } it { is_expected.to have_content('plep') }
it { is_expected.to have_content('plip') }
it { is_expected.to have_content('plop') }
it { is_expected.to have_content('plup') } it { is_expected.to have_content('plup') }
it { is_expected.to have_content('plyp') } it { is_expected.to have_content('plyp') }
end end

View file

@ -2,8 +2,9 @@ require 'spec_helper'
describe 'layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.html.haml', type: :view do describe 'layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.html.haml', type: :view do
let!(:dossier) { create(:dossier, :with_entreprise, state: state) } let!(:dossier) { create(:dossier, :with_entreprise, state: state, archived: archived) }
let(:state) { 'draft' } let(:state) { 'draft' }
let(:archived) { false }
let(:gestionnaire) { create(:gestionnaire) } let(:gestionnaire) { create(:gestionnaire) }
before do before do
@ -23,6 +24,11 @@ describe 'layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.htm
end end
context 'button dossier state changements' do context 'button dossier state changements' do
shared_examples 'button Passer en instruction is present' do
it { expect(rendered).to have_link('Passer en instruction') }
end
context 'when dossier have state initiated' do context 'when dossier have state initiated' do
let(:state) { 'initiated' } let(:state) { 'initiated' }
@ -30,12 +36,9 @@ describe 'layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.htm
render render
end end
it { expect(rendered).to have_content('Nouveau') } it { expect(rendered).to have_content('En construction') }
it 'button Déclarer complet is present' do include_examples 'button Passer en instruction is present'
expect(rendered).to have_css('.action')
expect(rendered).to have_content('DÉCLARER COMPLET')
end
end end
context 'when dossier have state replied' do context 'when dossier have state replied' do
@ -47,10 +50,7 @@ describe 'layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.htm
it { expect(rendered).to have_content('En construction') } it { expect(rendered).to have_content('En construction') }
it 'button Déclarer complet is present' do include_examples 'button Passer en instruction is present'
expect(rendered).to have_css('.action')
expect(rendered).to have_content('DÉCLARER COMPLET')
end
end end
context 'when dossier have state update' do context 'when dossier have state update' do
@ -62,44 +62,7 @@ describe 'layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.htm
it { expect(rendered).to have_content('En construction') } it { expect(rendered).to have_content('En construction') }
it 'button Déclarer complet is present' do include_examples 'button Passer en instruction is present'
expect(rendered).to have_css('.action')
expect(rendered).to have_content('DÉCLARER COMPLET')
end
end
context 'when dossier have state validated' do
let(:state) { 'validated' }
before do
render
end
it { expect(rendered).to have_content('Figé') }
it 'button Déclarer complet is not present' do
expect(rendered).not_to have_css('.action')
expect(rendered).not_to have_content('Déclarer complet')
end
end
context 'when dossier have state submitted' do
let(:state) { 'submitted' }
before do
render
end
it { expect(rendered).to have_content('Déposé / À réceptionner') }
it 'button Accuser réception is present' do
expect(rendered).to have_css('.action')
expect(rendered).to have_content('ACCUSER RÉCEPTION')
end
it 'button Déclarer complet is not present' do
expect(rendered).not_to have_content('Accepter le dossier')
end
end end
context 'when dossier have state received' do context 'when dossier have state received' do
@ -165,6 +128,28 @@ describe 'layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.htm
expect(rendered).not_to have_css('form[data-toggle="tooltip"][title="Refuser"]') expect(rendered).not_to have_css('form[data-toggle="tooltip"][title="Refuser"]')
end end
end end
context 'when dossier is not archived' do
let(:archived) { false }
before do
render
end
it { expect(rendered).to have_link('Archiver') }
end
context 'when dossier is archived' do
let(:archived) { true }
before do
render
end
it { expect(rendered).to have_content('Archivé') }
it { expect(rendered).to have_link('Désarchiver') }
end
end end
end end

View file

@ -1,67 +0,0 @@
require 'spec_helper'
describe 'layouts/left_panels/_left_panel_users_dossierscontroller_index.html.haml', type: :view do
shared_examples 'active_tab' do
let(:user) { create :user }
before do
sign_in user
create :dossier, user: user
assign :dossiers_list_facade, (DossiersListFacades.new user, param_list)
render
end
subject { rendered }
let(:active_class) { 'div.procedure_list_element.active '+active_klass }
let(:param_list) { liste }
it { is_expected.to have_selector(active_class) }
end
describe 'list brouillon' do
let(:active_klass) { '.progress-bar-default' }
let(:liste) { 'brouillon' }
it_behaves_like 'active_tab'
end
describe 'list en construction' do
let(:active_klass) { '.progress-bar-danger' }
let(:liste) { 'a_traiter' }
it_behaves_like 'active_tab'
end
describe 'list a depose' do
let(:active_klass) { '.progress-bar-purple' }
let(:liste) { 'valides' }
it_behaves_like 'active_tab'
end
describe 'list en examen' do
let(:active_klass) { '.progress-bar-default' }
let(:liste) { 'en_instruction' }
it_behaves_like 'active_tab'
end
describe 'list cloture' do
let(:active_klass) { '.progress-bar-success' }
let(:liste) { 'termine' }
it_behaves_like 'active_tab'
end
describe 'list invite' do
let(:active_klass) { '.progress-bar-warning' }
let(:liste) { 'invite' }
it_behaves_like 'active_tab'
end
end

View file

@ -17,7 +17,7 @@ describe 'layouts/left_panels/_left_panel_users_recapitulatifcontroller_show.htm
render render
end end
it { expect(rendered).to have_content('Nouveau') } it { expect(rendered).to have_content('En construction') }
end end
context 'when dossier state is replied' do context 'when dossier state is replied' do
@ -40,43 +40,6 @@ describe 'layouts/left_panels/_left_panel_users_recapitulatifcontroller_show.htm
it { expect(rendered).to have_content('En construction') } it { expect(rendered).to have_content('En construction') }
end end
context 'when dossier state is validated' do
let(:state) { 'validated' }
before do
render
end
it 'button Procéder au dépôt définitif est present' do
expect(rendered).to have_css('#validate_button')
expect(rendered).to have_content('Procéder au dépôt définitif')
end
it 'button Editer mon dossier n\'est plus present' do
expect(rendered).not_to have_css('#maj_infos')
expect(rendered).not_to have_content('Modifier mon dossier')
end
it 'button Modifier les document n\'est plus present' do
expect(rendered).not_to have_content('Modifier les documents')
end
end
context 'when dossier state is submitted' do
let(:state) { 'submitted' }
before do
render
end
it { expect(rendered).to have_content('Déposé / À réceptionner') }
it 'button Editer mon dossier n\'est plus present' do
expect(rendered).not_to have_css('#maj_infos')
expect(rendered).not_to have_content('Modifier mon dossier')
end
end
context 'when dossier state is closed' do context 'when dossier state is closed' do
let(:state) { 'closed' } let(:state) { 'closed' }

View file

@ -6,8 +6,6 @@ describe 'users/dossiers/index.html.haml', type: :view do
let!(:decorate_dossier_initiated) { create(:dossier, :with_entreprise, user: user, state: 'initiated').decorate } let!(:decorate_dossier_initiated) { create(:dossier, :with_entreprise, user: user, state: 'initiated').decorate }
let!(:decorate_dossier_replied) { create(:dossier, :with_entreprise, user: user, state: 'replied').decorate } let!(:decorate_dossier_replied) { create(:dossier, :with_entreprise, user: user, state: 'replied').decorate }
let!(:decorate_dossier_updated) { create(:dossier, :with_entreprise, user: user, state: 'updated').decorate } let!(:decorate_dossier_updated) { create(:dossier, :with_entreprise, user: user, state: 'updated').decorate }
let!(:decorate_dossier_validated) { create(:dossier, :with_entreprise, user: user, state: 'validated').decorate }
let!(:decorate_dossier_submitted) { create(:dossier, :with_entreprise, user: user, state: 'submitted').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 }
@ -61,27 +59,13 @@ describe 'users/dossiers/index.html.haml', type: :view do
end end
end end
describe 'on tab etude a deposer' do
let(:total_dossiers) { 1 }
let(:active_class) { '.active .text-purple' }
let(:dossiers_to_display) { user.dossiers.valides }
let(:liste) { 'valides' }
it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_validated }
end
end
describe 'on tab etude en examen' do describe 'on tab etude en examen' do
let(:total_dossiers) { 2 } let(:total_dossiers) { 1 }
let(:active_class) { '.active .text-default' } let(:active_class) { '.active .text-default' }
let(:dossiers_to_display) { user.dossiers.en_instruction } let(:dossiers_to_display) { user.dossiers.en_instruction }
let(:liste) { 'en_instruction' } let(:liste) { 'en_instruction' }
it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_submitted }
end
it_behaves_like 'check_tab_content' do it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_received } let(:decorate_dossier_at_check) { decorate_dossier_received }
end end

View file

@ -107,18 +107,6 @@ describe 'users/recapitulatif/show.html.haml', type: :view do
expect(rendered).not_to have_content('Archiver') expect(rendered).not_to have_content('Archiver')
end end
end end
context 'when dossier is validated' do
let(:state) { 'validated' }
before do
render
end
it 'submitted link is not present' do
expect(rendered).not_to have_content('Procéder au dépôt définitif')
end
end
end end
context 'invite is by User' do context 'invite is by User' do
@ -148,18 +136,6 @@ describe 'users/recapitulatif/show.html.haml', type: :view do
expect(rendered).not_to have_content('Archiver') expect(rendered).not_to have_content('Archiver')
end end
end end
context 'when dossier is validated' do
let(:state) { 'validated' }
before do
render
end
it 'submitted link is not present' do
expect(rendered).not_to have_content('Procéder au dépôt définitif')
end
end
end end
end end
end end