Merge branch 'develop' into staging
This commit is contained in:
commit
452d91e0a1
28 changed files with 250 additions and 78 deletions
2
Gemfile
2
Gemfile
|
@ -82,7 +82,7 @@ gem 'mailjet'
|
|||
|
||||
gem "smart_listing"
|
||||
|
||||
gem 'css_splitter'
|
||||
# gem 'css_splitter'
|
||||
gem 'bootstrap-wysihtml5-rails', '~> 0.3.3.8'
|
||||
|
||||
gem 'as_csv'
|
||||
|
|
|
@ -115,8 +115,6 @@ GEM
|
|||
concurrent-ruby (1.0.2)
|
||||
crack (0.4.2)
|
||||
safe_yaml (~> 1.0.0)
|
||||
css_splitter (0.4.5)
|
||||
sprockets (>= 2.0.0)
|
||||
database_cleaner (1.4.1)
|
||||
debug_inspector (0.0.2)
|
||||
deep_cloneable (2.2.1)
|
||||
|
@ -636,7 +634,6 @@ DEPENDENCIES
|
|||
chartkick
|
||||
clamav-client
|
||||
coffee-rails (~> 4.1.0)
|
||||
css_splitter
|
||||
database_cleaner
|
||||
deep_cloneable (~> 2.2.1)
|
||||
devise
|
||||
|
|
|
@ -187,7 +187,7 @@ class Admin::ProceduresController < AdminController
|
|||
private
|
||||
|
||||
def create_procedure_params
|
||||
params.require(:procedure).permit(:libelle, :description, :organisation, :direction, :lien_demarche, :lien_site_web, :lien_notice, :euro_flag, :logo, :cerfa_flag, module_api_carto_attributes: [:id, :use_api_carto, :quartiers_prioritaires, :cadastre]).merge(administrateur_id: current_administrateur.id)
|
||||
params.require(:procedure).permit(:libelle, :description, :organisation, :direction, :lien_demarche, :lien_site_web, :lien_notice, :euro_flag, :logo, :cerfa_flag, :for_individual, module_api_carto_attributes: [:id, :use_api_carto, :quartiers_prioritaires, :cadastre]).merge(administrateur_id: current_administrateur.id)
|
||||
end
|
||||
|
||||
def create_module_api_carto_params
|
||||
|
|
|
@ -84,8 +84,12 @@ class Users::DossiersController < UsersController
|
|||
@facade = facade params[:dossier][:id]
|
||||
|
||||
if checked_autorisation_donnees?
|
||||
@facade.dossier.update_attributes(update_params)
|
||||
|
||||
begin
|
||||
@facade.dossier.update_attributes!(update_params)
|
||||
rescue
|
||||
flash.now.alert = @facade.dossier.errors.full_messages.join('<br />').html_safe
|
||||
return render 'show'
|
||||
end
|
||||
if @facade.dossier.procedure.module_api_carto.use_api_carto
|
||||
redirect_to url_for(controller: :carte, action: :show, dossier_id: @facade.dossier.id)
|
||||
else
|
||||
|
@ -117,7 +121,7 @@ class Users::DossiersController < UsersController
|
|||
end
|
||||
|
||||
def update_params
|
||||
params.require(:dossier).permit(:autorisation_donnees)
|
||||
params.require(:dossier).permit(:id, :autorisation_donnees, individual_attributes: [:nom, :prenom, :birthdate])
|
||||
end
|
||||
|
||||
def checked_autorisation_donnees?
|
||||
|
|
|
@ -2,7 +2,7 @@ class EntrepriseDecorator < Draper::Decorator
|
|||
delegate_all
|
||||
|
||||
def raison_sociale_or_name
|
||||
raison_sociale.nil? ? nom + ' ' + prenom : raison_sociale
|
||||
raison_sociale.blank? ? nom + ' ' + prenom : raison_sociale
|
||||
end
|
||||
|
||||
def effectif
|
||||
|
|
|
@ -50,6 +50,10 @@ class DossierFacades
|
|||
@dossier.ordered_champs_private
|
||||
end
|
||||
|
||||
def individual
|
||||
@dossier.individual
|
||||
end
|
||||
|
||||
def commentaires_files
|
||||
PieceJustificative.where(dossier_id: @dossier.id, type_de_piece_justificative_id: nil)
|
||||
end
|
||||
|
|
|
@ -14,6 +14,7 @@ class Dossier < ActiveRecord::Base
|
|||
|
||||
has_one :etablissement, dependent: :destroy
|
||||
has_one :entreprise, dependent: :destroy
|
||||
has_one :individual, dependent: :destroy
|
||||
has_many :cerfa, dependent: :destroy
|
||||
|
||||
has_many :pieces_justificatives, dependent: :destroy
|
||||
|
@ -28,6 +29,8 @@ class Dossier < ActiveRecord::Base
|
|||
belongs_to :procedure
|
||||
belongs_to :user
|
||||
|
||||
accepts_nested_attributes_for :individual
|
||||
|
||||
delegate :siren, to: :entreprise
|
||||
delegate :siret, to: :etablissement, allow_nil: true
|
||||
delegate :types_de_piece_justificative, to: :procedure
|
||||
|
@ -35,6 +38,7 @@ class Dossier < ActiveRecord::Base
|
|||
delegate :france_connect_information, to: :user
|
||||
|
||||
after_save :build_default_champs, if: Proc.new { procedure_id_changed? }
|
||||
after_save :build_default_individual, if: Proc.new { procedure.for_individual? }
|
||||
|
||||
validates :user, presence: true
|
||||
|
||||
|
@ -66,6 +70,12 @@ class Dossier < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def build_default_individual
|
||||
Individual.new(dossier_id: id).save(validate: false)
|
||||
Entreprise.new(dossier_id: id).save(validate: false)
|
||||
Etablissement.new(dossier_id: id, entreprise_id: entreprise.id).save(validate: false)
|
||||
end
|
||||
|
||||
def ordered_champs
|
||||
champs.joins(', types_de_champ').where("champs.type_de_champ_id = types_de_champ.id AND types_de_champ.procedure_id = #{procedure.id}").order('order_place')
|
||||
end
|
||||
|
|
|
@ -4,4 +4,10 @@ class Entreprise < ActiveRecord::Base
|
|||
has_one :rna_information, dependent: :destroy
|
||||
|
||||
validates_presence_of :siren
|
||||
|
||||
before_save :default_values
|
||||
|
||||
def default_values
|
||||
self.raison_sociale ||= ''
|
||||
end
|
||||
end
|
||||
|
|
9
app/models/individual.rb
Normal file
9
app/models/individual.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
class Individual < ActiveRecord::Base
|
||||
belongs_to :dossier
|
||||
|
||||
validates_uniqueness_of :dossier_id
|
||||
|
||||
validates :nom, presence: true, allow_nil: false, allow_blank: false
|
||||
validates :prenom, presence: true, allow_nil: false, allow_blank: false
|
||||
validates :birthdate, presence: true, allow_nil: false, allow_blank: false
|
||||
end
|
|
@ -52,6 +52,17 @@
|
|||
%h4 Formulaire / CERFA
|
||||
%label
|
||||
=f.check_box :cerfa_flag
|
||||
Activer l'envoi de formulaire / CERFA
|
||||
Activer l'envoi de formulaire / CERFA
|
||||
%br
|
||||
=f.text_field :lien_demarche, class: 'form-control', placeholder: 'URL vers le formulaire vierge (facultatif)'
|
||||
|
||||
%br
|
||||
.row
|
||||
.col-md-6.col-lg-6
|
||||
%h4 Particuliers
|
||||
%label
|
||||
=f.check_box :for_individual
|
||||
Cette procédure s'adresse à un public qui
|
||||
%b
|
||||
ne possède pas de numéro SIRET,
|
||||
qui doivent donc s'identifier en tant que personne physique.
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
= @facade.dossier.display_state
|
||||
|
||||
= render partial: 'follow_action'
|
||||
|
||||
= render partial: '/dossiers/infos_entreprise'
|
||||
- unless @facade.procedure.for_individual?
|
||||
= render partial: '/dossiers/infos_entreprise'
|
||||
|
||||
= render partial: '/dossiers/infos_dossier'
|
||||
%br
|
||||
|
|
|
@ -1,40 +1,4 @@
|
|||
.etape.etapes_menu.col-md-3.col-lg-3
|
||||
%h3
|
||||
Mes informations
|
||||
%br
|
||||
- unless @facade.entreprise.nil?
|
||||
.center{style:'margin-left: -5%'}
|
||||
Vous êtes authentifié avec le SIRET
|
||||
|
||||
%h3.text-success
|
||||
= @facade.etablissement.siret
|
||||
= form_for @facade.dossier, url: users_dossier_change_siret_path(dossier_id: @facade.dossier.id), method: :put, remote: true do |f|
|
||||
= f.submit 'Changer de SIRET', class: %w(btn btn-xs btn-primary)
|
||||
|
||||
|
||||
.etape.etapes_informations.col-md-9.col-lg-9
|
||||
.row
|
||||
- if @facade.entreprise.nil?
|
||||
#new_siret{style:'margin-left: 20%; margin-top: 5%'}
|
||||
= form_for @facade.dossier, html: {class: 'form-inline'}, url: users_dossier_siret_informations_path(dossier_id: @facade.dossier.id), method: :post, remote: true do |f|
|
||||
.form-group.form-group-lg
|
||||
= f.text_field :siret, class: "form-control", placeholder: "Entrez votre Siret", value: @siret
|
||||
= f.hidden_field :dossier_id, value: @facade.dossier.id
|
||||
= f.submit 'Valider', class: %w(btn btn-lg btn-success), data: { disable_with: "Recherche en cours ..." }
|
||||
- else
|
||||
%br
|
||||
#recap_info_entreprise
|
||||
= render partial: '/dossiers/infos_entreprise'
|
||||
|
||||
%p#insee_infogreffe{style:'color:grey; float:right'}
|
||||
%i
|
||||
Informations récupérées auprès de l'INSEE et d'INFOGREFFE
|
||||
|
||||
%br
|
||||
= form_for @facade.dossier, url: { controller: '/users/dossiers', action: :update } do |f|
|
||||
= f.hidden_field :id
|
||||
%label{ style:'font-weight:normal' }
|
||||
= f.check_box :autorisation_donnees
|
||||
J'autorise les décideurs publics à vérifier les informations de mon organisation auprès des administrations concernées. Ces informations resteront strictement confidentielles.
|
||||
%br
|
||||
= f.submit 'Etape suivante', class: "btn btn btn-info", style: 'float:right', id: 'etape_suivante', disabled: :disabled
|
||||
- if @facade.procedure.for_individual?
|
||||
= render partial: 'dossiers/etapes/etape_2/individual'
|
||||
- else
|
||||
= render partial: 'dossiers/etapes/etape_2/entreprise'
|
40
app/views/dossiers/etapes/etape_2/_entreprise.html.haml
Normal file
40
app/views/dossiers/etapes/etape_2/_entreprise.html.haml
Normal file
|
@ -0,0 +1,40 @@
|
|||
.etape.etapes_menu.col-md-3.col-lg-3
|
||||
%h3
|
||||
Mes informations
|
||||
%br
|
||||
- unless @facade.entreprise.nil?
|
||||
.center{style:'margin-left: -5%'}
|
||||
Vous êtes authentifié avec le SIRET
|
||||
|
||||
%h3.text-success
|
||||
= @facade.etablissement.siret
|
||||
= form_for @facade.dossier, url: users_dossier_change_siret_path(dossier_id: @facade.dossier.id), method: :put, remote: true do |f|
|
||||
= f.submit 'Changer de SIRET', class: %w(btn btn-xs btn-primary)
|
||||
|
||||
|
||||
.etape.etapes_informations.col-md-9.col-lg-9
|
||||
.row
|
||||
- if @facade.entreprise.nil?
|
||||
#new_siret{style:'margin-left: 20%; margin-top: 5%'}
|
||||
= form_for @facade.dossier, html: {class: 'form-inline'}, url: users_dossier_siret_informations_path(dossier_id: @facade.dossier.id), method: :post, remote: true do |f|
|
||||
.form-group.form-group-lg
|
||||
= f.text_field :siret, class: "form-control", placeholder: "Entrez votre Siret", value: @siret
|
||||
= f.hidden_field :dossier_id, value: @facade.dossier.id
|
||||
= f.submit 'Valider', class: %w(btn btn-lg btn-success), data: { disable_with: "Recherche en cours ..." }
|
||||
- else
|
||||
%br
|
||||
#recap_info_entreprise
|
||||
= render partial: '/dossiers/infos_entreprise'
|
||||
|
||||
%p#insee_infogreffe{style:'color:grey; float:right'}
|
||||
%i
|
||||
Informations récupérées auprès de l'INSEE et d'INFOGREFFE
|
||||
|
||||
%br
|
||||
= form_for @facade.dossier, url: { controller: '/users/dossiers', action: :update } do |f|
|
||||
= f.hidden_field :id
|
||||
%label{ style:'font-weight:normal' }
|
||||
= f.check_box :autorisation_donnees
|
||||
J'autorise les décideurs publics à vérifier les informations de mon organisation auprès des administrations concernées. Ces informations resteront strictement confidentielles.
|
||||
%br
|
||||
= f.submit 'Etape suivante', class: "btn btn btn-info", style: 'float:right', id: 'etape_suivante', disabled: :disabled
|
40
app/views/dossiers/etapes/etape_2/_individual.html.haml
Normal file
40
app/views/dossiers/etapes/etape_2/_individual.html.haml
Normal file
|
@ -0,0 +1,40 @@
|
|||
.etape.etapes_menu.col-md-3.col-lg-3
|
||||
%h3
|
||||
Mes informations
|
||||
%br
|
||||
%p.center
|
||||
Les informations de bases
|
||||
%br
|
||||
vous concernant.
|
||||
|
||||
.etape.etapes_informations.col-md-9.col-lg-9
|
||||
.row
|
||||
= form_for @facade.dossier, url: { controller: '/users/dossiers', action: :update } do |f|
|
||||
= f.hidden_field :id
|
||||
|
||||
= f.fields_for :individual, @facade.individual do |ff|
|
||||
.form-group
|
||||
%label
|
||||
%h4
|
||||
Nom
|
||||
= ff.text_field :nom, {class: 'form-control'}
|
||||
.form-group
|
||||
%label
|
||||
%h4
|
||||
Prénom
|
||||
= ff.text_field :prenom, {class: 'form-control'}
|
||||
.form-group
|
||||
%label
|
||||
%h4
|
||||
Date de naissance
|
||||
= ff.text_field :birthdate, {class: 'form-control', 'data-provide' => 'datepicker', 'data-date-format' => 'dd/mm/yyyy'}
|
||||
|
||||
%p
|
||||
%label{ style:'font-weight:normal' }
|
||||
= f.check_box :autorisation_donnees
|
||||
= " ".html_safe
|
||||
Vos informations personnelles ne seront jamais utilisées dans un but lucratif ou commercial. Elles ne pourront être communiquées à de tiers personnes sans votre accord préalable. Elles pourront en revanche être communiquées aux administrations compétentes afin d'instruire votre dossier, conformément à la déclaration CNIL effectué par le service TPS.
|
||||
=link_to 'en savoir plus', cgu_path, target: '_blank'
|
||||
|
||||
%br
|
||||
= f.submit 'Etape suivante', class: "btn btn btn-info", style: 'float:right', id: 'etape_suivante'
|
4
app/views/layouts/_ie_lt_10.html.haml
Normal file
4
app/views/layouts/_ie_lt_10.html.haml
Normal file
|
@ -0,0 +1,4 @@
|
|||
%div.center{style:'width: 100%; background-color: white; position: fixed; top:0; left:0; z-index: 100000'}
|
||||
%h3.text-danger
|
||||
%b
|
||||
Votre version d'Internet Explorer est trop ancienne pour être utilisée sur le service TPS. Version minimum : Internet Explorer 10
|
|
@ -8,7 +8,6 @@
|
|||
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
|
||||
= stylesheet_link_tag 'application_split2', media: 'all', 'data-turbolinks-track' => true
|
||||
|
||||
|
||||
= javascript_include_tag 'application', 'data-turbolinks-track' => true
|
||||
= csrf_meta_tags
|
||||
%body
|
||||
|
@ -16,6 +15,12 @@
|
|||
%script{type: 'text/javascript'}
|
||||
(typeof jQuery !== 'undefined') && (jQuery.fx.off = true);
|
||||
|
||||
="<!--[if lt IE 10]>".html_safe
|
||||
|
||||
= render partial: 'layouts/ie_lt_10'
|
||||
|
||||
="<![endif]-->".html_safe
|
||||
|
||||
%div#wrap
|
||||
%div#header.navbar
|
||||
=render partial: "layouts/navbar"
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
- unless smart_listing.empty?
|
||||
%table.table
|
||||
%thead
|
||||
%th.col-md-4.col-lg-4= smart_listing.sortable 'Procédure', 'procedure.libelle'
|
||||
%th.col-md-4.col-lg-4= smart_listing.sortable 'Raison sociale', 'entreprise.raison_sociale'
|
||||
%th.col-md-1.col-lg-1= smart_listing.sortable 'Numéro', 'id'
|
||||
%th.col-md-5.col-lg-5= smart_listing.sortable 'Procédure', 'procedure.libelle'
|
||||
%th.col-md-2.col-lg-2= smart_listing.sortable 'État', 'state'
|
||||
%th.col-md-2.col-lg-2= smart_listing.sortable 'Date de mise à jour', 'updated_at'
|
||||
- @dossiers.each do |dossier|
|
||||
|
@ -12,11 +12,11 @@
|
|||
- else
|
||||
- dossier = dossier.decorate
|
||||
%tr
|
||||
%td.center
|
||||
= dossier.id
|
||||
%td
|
||||
= dossier.procedure.libelle
|
||||
%td
|
||||
= link_to(dossier.entreprise.raison_sociale, users_dossiers_invite_path(id: invite.id)) unless invite.nil?
|
||||
= link_to(dossier.entreprise.raison_sociale, users_dossier_recapitulatif_path(dossier)) if invite.nil?
|
||||
= link_to(dossier.procedure.libelle, users_dossiers_invite_path(id: invite.id)) unless invite.nil?
|
||||
= link_to(dossier.procedure.libelle, users_dossier_recapitulatif_path(dossier)) if invite.nil?
|
||||
|
||||
%td{id: "dossier_#{dossier.id}_state"}= dossier.display_state
|
||||
%td= dossier.last_update
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
= devise_error_messages!
|
||||
|
||||
#form_login
|
||||
%br
|
||||
= image_tag('logo-tps.png')
|
||||
%br
|
||||
%h2#gestionnaire_login Inscription
|
||||
|
|
19
config/locales/models/individual/fr.yml
Normal file
19
config/locales/models/individual/fr.yml
Normal file
|
@ -0,0 +1,19 @@
|
|||
fr:
|
||||
activerecord:
|
||||
attributes:
|
||||
individual:
|
||||
nom: Nom
|
||||
prenom: Prénom
|
||||
birthdate: Date de naissance
|
||||
errors:
|
||||
models:
|
||||
individual:
|
||||
attributes:
|
||||
nom:
|
||||
blank: 'doit être rempli'
|
||||
prenom:
|
||||
blank: 'doit être rempli'
|
||||
birthdate:
|
||||
blank: 'doit être rempli'
|
||||
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
class AddForIndividualAttrInProcedureTable < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :procedures, :for_individual, :boolean, default: false
|
||||
end
|
||||
end
|
11
db/migrate/20160829114646_create_individual_table.rb
Normal file
11
db/migrate/20160829114646_create_individual_table.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
class CreateIndividualTable < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :individuals do |t|
|
||||
t.string :nom
|
||||
t.string :prenom
|
||||
t.string :birthdate
|
||||
end
|
||||
|
||||
add_belongs_to :individuals, :dossier
|
||||
end
|
||||
end
|
10
db/schema.rb
10
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20160824094451) do
|
||||
ActiveRecord::Schema.define(version: 20160829114646) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -213,6 +213,13 @@ ActiveRecord::Schema.define(version: 20160824094451) do
|
|||
add_index "gestionnaires", ["email"], name: "index_gestionnaires_on_email", unique: true, using: :btree
|
||||
add_index "gestionnaires", ["reset_password_token"], name: "index_gestionnaires_on_reset_password_token", unique: true, using: :btree
|
||||
|
||||
create_table "individuals", force: :cascade do |t|
|
||||
t.string "nom"
|
||||
t.string "prenom"
|
||||
t.string "birthdate"
|
||||
t.integer "dossier_id"
|
||||
end
|
||||
|
||||
create_table "invites", force: :cascade do |t|
|
||||
t.string "email"
|
||||
t.string "email_sender"
|
||||
|
@ -278,6 +285,7 @@ ActiveRecord::Schema.define(version: 20160824094451) do
|
|||
t.boolean "published", default: false, null: false
|
||||
t.string "lien_site_web"
|
||||
t.string "lien_notice"
|
||||
t.boolean "for_individual", default: false
|
||||
end
|
||||
|
||||
create_table "quartier_prioritaires", force: :cascade do |t|
|
||||
|
|
|
@ -29,5 +29,21 @@ feature 'on backoffice page' do
|
|||
expect(page).to have_css('#backoffice_dossier_show')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when gestionnaire have enterprise and individual dossier in his inbox' do
|
||||
let!(:procedure_individual) { create :procedure, libelle: 'procedure individual', administrateur: administrateur, for_individual: true }
|
||||
let!(:dossier_individual) { create :dossier, procedure: procedure_individual, state: 'updated' }
|
||||
|
||||
before do
|
||||
create :assign_to, gestionnaire: gestionnaire, procedure: procedure_individual
|
||||
|
||||
visit backoffice_path
|
||||
page.click_on dossier_individual.id
|
||||
end
|
||||
|
||||
scenario 'it redirect to dossier page' do
|
||||
expect(page).to have_css('#backoffice_dossier_show')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -9,8 +9,8 @@ feature 'user access to the list of his dossier' do
|
|||
|
||||
before do
|
||||
dossier1.update_column(:updated_at, "19/07/2052 15:35".to_time)
|
||||
dossier1.entreprise.update_column(:raison_sociale, 'PLOP')
|
||||
last_updated_dossier.entreprise.update_column(:raison_sociale, 'PLIP')
|
||||
dossier1.procedure.update_column(:libelle, 'PLOP')
|
||||
last_updated_dossier.procedure.update_column(:libelle, 'PLIP')
|
||||
|
||||
visit new_user_session_path
|
||||
within('#new_user') do
|
||||
|
@ -20,12 +20,12 @@ feature 'user access to the list of his dossier' do
|
|||
end
|
||||
end
|
||||
scenario 'the list of dossier is displayed' do
|
||||
expect(page).to have_content(dossier1.entreprise.raison_sociale)
|
||||
expect(page).not_to have_content(dossier2.entreprise.raison_sociale)
|
||||
expect(page).to have_content(dossier1.procedure.libelle)
|
||||
expect(page).not_to have_content(dossier2.procedure.libelle)
|
||||
end
|
||||
|
||||
scenario 'the list must be order by last updated' do
|
||||
expect(page.body).to match(/#{last_updated_dossier.entreprise.raison_sociale}.*#{dossier1.entreprise.raison_sociale}/m)
|
||||
expect(page.body).to match(/#{last_updated_dossier.procedure.libelle}.*#{dossier1.procedure.libelle}/m)
|
||||
end
|
||||
|
||||
scenario 'the state of dossier is displayed' do
|
||||
|
@ -34,7 +34,7 @@ feature 'user access to the list of his dossier' do
|
|||
|
||||
context 'when user clicks on a projet in list' do
|
||||
before do
|
||||
page.click_on dossier1.entreprise.raison_sociale
|
||||
page.click_on dossier1.procedure.libelle
|
||||
end
|
||||
scenario 'user is redirected to dossier page' do
|
||||
expect(page).to have_css('#recap_dossier')
|
||||
|
|
|
@ -19,7 +19,7 @@ RSpec.describe NotificationMailer, type: :mailer do
|
|||
subject(:subject) { described_class.dossier_validated(dossier) }
|
||||
|
||||
it { expect(subject.body).to match("Votre dossier N°#{dossier.id} a été validé par votre accompagnateur.") }
|
||||
it { expect(subject.body).to include("Afin de finaliser son dépot, merci de vous rendre sur #{users_dossier_recapitulatif_url(dossier_id: dossier.id)}") }
|
||||
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("Votre dossier TPS N°#{dossier.id} a été validé") }
|
||||
end
|
||||
|
||||
|
@ -30,7 +30,7 @@ RSpec.describe NotificationMailer, type: :mailer do
|
|||
subject(:subject) { described_class.dossier_submitted(dossier) }
|
||||
|
||||
it { expect(subject.body).to match("Nous vous confirmons que votre dossier N°#{dossier.id} a été déposé") }
|
||||
it { expect(subject.body).to match("aurpès de #{dossier.procedure.organisation} avec succès") }
|
||||
it { expect(subject.body).to match("auprès de #{dossier.procedure.organisation} avec succès") }
|
||||
it { expect(subject.body).to match("ce jour à #{dossier.updated_at}.") }
|
||||
it { expect(subject.subject).to eq("Votre dossier TPS N°#{dossier.id} a été déposé") }
|
||||
end
|
||||
|
|
|
@ -23,6 +23,7 @@ describe Dossier do
|
|||
it { is_expected.to have_many(:cerfa) }
|
||||
it { is_expected.to have_one(:etablissement) }
|
||||
it { is_expected.to have_one(:entreprise) }
|
||||
it { is_expected.to have_one(:individual) }
|
||||
it { is_expected.to belong_to(:user) }
|
||||
it { is_expected.to have_many(:invites) }
|
||||
it { is_expected.to have_many(:follows) }
|
||||
|
@ -105,6 +106,24 @@ describe Dossier do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#build_default_individual' do
|
||||
context 'when dossier is linked to a procedure with for_individual attr false' do
|
||||
let(:dossier) { create(:dossier, user: user) }
|
||||
|
||||
it 'have no object created' do
|
||||
expect(dossier.individual).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier is linked to a procedure with for_individual attr true' do
|
||||
let(:dossier) { create(:dossier, user: user, procedure: (create :procedure, for_individual: true)) }
|
||||
|
||||
it 'have no object created' do
|
||||
expect(dossier.individual).not_to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#save' do
|
||||
subject { build(:dossier, procedure: procedure, user: user) }
|
||||
let!(:procedure) { create(:procedure) }
|
||||
|
|
8
spec/models/individual_spec.rb
Normal file
8
spec/models/individual_spec.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Individual do
|
||||
it { is_expected.to have_db_column(:nom) }
|
||||
it { is_expected.to have_db_column(:prenom) }
|
||||
it { is_expected.to have_db_column(:birthdate) }
|
||||
it { is_expected.to belong_to(:dossier) }
|
||||
end
|
|
@ -15,15 +15,6 @@ describe 'users/dossiers/index.html.haml', type: :view do
|
|||
let!(:decorate_dossier_invite) { create(:dossier, :with_entreprise, user: create(:user), state: 'initiated').decorate }
|
||||
|
||||
before do
|
||||
decorate_dossier_replied.entreprise.update_column(:raison_sociale, 'plap')
|
||||
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_closed.entreprise.update_column(:raison_sociale, 'plyp')
|
||||
decorate_dossier_refused.entreprise.update_column(:raison_sociale, 'plzp')
|
||||
decorate_dossier_without_continuation.entreprise.update_column(:raison_sociale, 'plnp')
|
||||
|
||||
create :invite, dossier: decorate_dossier_invite, user: user
|
||||
end
|
||||
|
||||
|
@ -42,8 +33,8 @@ describe 'users/dossiers/index.html.haml', type: :view do
|
|||
subject { rendered }
|
||||
|
||||
describe 'columns' do
|
||||
it { is_expected.to have_content(decorate_dossier_at_check.id) }
|
||||
it { is_expected.to have_content(decorate_dossier_at_check.procedure.libelle) }
|
||||
it { is_expected.to have_content(decorate_dossier_at_check.entreprise.raison_sociale) }
|
||||
it { is_expected.to have_content(decorate_dossier_at_check.display_state) }
|
||||
it { is_expected.to have_content(decorate_dossier_at_check.last_update) }
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue