Delete utilisation of "nom_projet" attribut (no delete in database)
This commit is contained in:
parent
9221a0bb26
commit
7d0bcfc35f
29 changed files with 95 additions and 193 deletions
|
@ -164,10 +164,6 @@ textarea#description {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
input#nom_projet {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.logo_fc_small {
|
.logo_fc_small {
|
||||||
max-width: 27px;
|
max-width: 27px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,6 +102,6 @@ class Users::DescriptionController < UsersController
|
||||||
private
|
private
|
||||||
|
|
||||||
def create_params
|
def create_params
|
||||||
params.permit(:nom_projet)
|
params.permit()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -30,7 +30,6 @@ class Dossier < ActiveRecord::Base
|
||||||
|
|
||||||
after_save :build_default_champs, if: Proc.new { procedure_id_changed? }
|
after_save :build_default_champs, if: Proc.new { procedure_id_changed? }
|
||||||
|
|
||||||
validates :nom_projet, presence: true, allow_blank: false, allow_nil: true
|
|
||||||
validates :user, presence: true
|
validates :user, presence: true
|
||||||
|
|
||||||
WAITING_FOR_GESTIONNAIRE = %w(initiated updated submitted)
|
WAITING_FOR_GESTIONNAIRE = %w(initiated updated submitted)
|
||||||
|
@ -161,7 +160,6 @@ class Dossier < ActiveRecord::Base
|
||||||
query_string_start_with = "#{word}%"
|
query_string_start_with = "#{word}%"
|
||||||
|
|
||||||
composed_scope = composed_scope.where(
|
composed_scope = composed_scope.where(
|
||||||
dossiers[:nom_projet].matches(query_string).or\
|
|
||||||
users[:email].matches(query_string).or\
|
users[:email].matches(query_string).or\
|
||||||
etablissements[:siret].matches(query_string_start_with).or\
|
etablissements[:siret].matches(query_string_start_with).or\
|
||||||
entreprises[:raison_sociale].matches(query_string))
|
entreprises[:raison_sociale].matches(query_string))
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
class DossierSerializer < ActiveModel::Serializer
|
class DossierSerializer < ActiveModel::Serializer
|
||||||
attributes :id,
|
attributes :id,
|
||||||
:nom_projet,
|
|
||||||
:created_at,
|
:created_at,
|
||||||
:updated_at,
|
:updated_at,
|
||||||
:archived,
|
:archived,
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
class DossiersSerializer < ActiveModel::Serializer
|
class DossiersSerializer < ActiveModel::Serializer
|
||||||
attributes :id,
|
attributes :id,
|
||||||
:nom_projet,
|
|
||||||
:updated_at
|
:updated_at
|
||||||
end
|
end
|
|
@ -2,7 +2,7 @@
|
||||||
%table.table
|
%table.table
|
||||||
%thead
|
%thead
|
||||||
%th= smart_listing.sortable 'Procédure', 'procedure.libelle'
|
%th= smart_listing.sortable 'Procédure', 'procedure.libelle'
|
||||||
%th= smart_listing.sortable 'Dossier', 'nom_projet'
|
%th= smart_listing.sortable 'Raison sociale', 'entreprise.raison_sociale'
|
||||||
%th= smart_listing.sortable 'État', 'state'
|
%th= smart_listing.sortable 'État', 'state'
|
||||||
%th= smart_listing.sortable 'Date de mise à jour', 'updated_at'
|
%th= smart_listing.sortable 'Date de mise à jour', 'updated_at'
|
||||||
- unless @liste == 'termine'
|
- unless @liste == 'termine'
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
%tr
|
%tr
|
||||||
%td.col-md-4.col-lg-4= dossier.procedure.libelle
|
%td.col-md-4.col-lg-4= dossier.procedure.libelle
|
||||||
%td.col-md-4.col-lg-4
|
%td.col-md-4.col-lg-4
|
||||||
= link_to(dossier.nom_projet, "/backoffice/dossiers/#{dossier.id}")
|
= link_to(dossier.entreprise.raison_sociale, "/backoffice/dossiers/#{dossier.id}")
|
||||||
%td= dossier.display_state
|
%td= dossier.display_state
|
||||||
%td= dossier.last_update
|
%td= dossier.last_update
|
||||||
- unless @liste == 'termine'
|
- unless @liste == 'termine'
|
||||||
|
|
|
@ -8,16 +8,14 @@
|
||||||
%h4
|
%h4
|
||||||
= "Dossier N°#{@dossier.id}"
|
= "Dossier N°#{@dossier.id}"
|
||||||
%tr
|
%tr
|
||||||
%td.col-md-2.col-lg-1
|
%td.col-md-1.col-lg-1
|
||||||
= @dossier.id
|
= @dossier.id
|
||||||
%td.col-md-4.col-lg-3
|
%td.col-md-4.col-lg-4
|
||||||
= link_to(@dossier.nom_projet, "/backoffice/dossiers/#{@dossier.id}")
|
= @dossier.procedure.libelle
|
||||||
%td.col-md-2.col-lg-3
|
%td.col-md-4.col-lg-4
|
||||||
= @dossier.entreprise.raison_sociale
|
= link_to(@dossier.entreprise.raison_sociale, "/backoffice/dossiers/#{@dossier.id}")
|
||||||
%td.col-md-4.col-lg-2
|
|
||||||
= @dossier.user.email
|
|
||||||
%td.col-md-2.col-lg-2
|
%td.col-md-2.col-lg-2
|
||||||
= @dossier.etablissement.siret
|
= @dossier.user.email
|
||||||
%td.col-md-1.col-lg-1{class: @dossier.state_color_class}
|
%td.col-md-1.col-lg-1{class: @dossier.state_color_class}
|
||||||
= @dossier.display_state
|
= @dossier.display_state
|
||||||
%br
|
%br
|
||||||
|
@ -29,21 +27,18 @@
|
||||||
- elsif !@dossiers_search.empty?
|
- elsif !@dossiers_search.empty?
|
||||||
%table.table
|
%table.table
|
||||||
%tr
|
%tr
|
||||||
%th.col-md-2.col-lg-1 ID dossier
|
%th.col-md-1.col-lg-1 ID dossier
|
||||||
%th.col-md-4.col-lg-3 Dossier
|
%th.col-md-4.col-lg-4 Procédure
|
||||||
%th.col-md-2.col-lg-3 Raison Sociale
|
%th.col-md-4.col-lg-4 Raison Sociale
|
||||||
%th.col-md-4.col-lg-2 Email contact
|
%th.col-md-2.col-lg-2 Email contact
|
||||||
%th.col-md-2.col-lg-2 SIRET
|
|
||||||
%th.col-md-1.col-lg-1 État
|
%th.col-md-1.col-lg-1 État
|
||||||
|
|
||||||
- @dossiers_search.each do |dossier|
|
- @dossiers_search.each do |dossier|
|
||||||
%tr
|
%tr
|
||||||
%td= dossier.id
|
%td= dossier.id
|
||||||
%td
|
%td= dossier.procedure.libelle
|
||||||
= link_to(dossier.nom_projet, "/backoffice/dossiers/#{dossier.id}")
|
%td= link_to(dossier.entreprise.raison_sociale, "/backoffice/dossiers/#{dossier.id}")
|
||||||
%td= dossier.entreprise.raison_sociale
|
|
||||||
%td= dossier.user.email
|
%td= dossier.user.email
|
||||||
%td= dossier.etablissement.siret
|
|
||||||
%td{class: dossier.state_color_class}= dossier.display_state
|
%td{class: dossier.state_color_class}= dossier.display_state
|
||||||
|
|
||||||
.pagination
|
.pagination
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
#infos_dossier
|
#infos_dossier
|
||||||
%div.row
|
%div.row
|
||||||
.col-lg-6.col-md-6
|
.col-lg-6.col-md-6
|
||||||
%h3.text-info
|
%h3
|
||||||
= @facade.dossier.nom_projet
|
|
||||||
%h4
|
|
||||||
= @facade.dossier.procedure.libelle
|
= @facade.dossier.procedure.libelle
|
||||||
|
|
||||||
- if @facade.dossier.mandataire_social && gestionnaire_signed_in?
|
- if @facade.dossier.mandataire_social && gestionnaire_signed_in?
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
Bonjour <%= @invite.email %>
|
Bonjour <%= @invite.email %>
|
||||||
|
|
||||||
L'utilisateur <%= @invite.email_sender %> souhaite que vous participiez à l'élaboration d'un dossier sur la plateforme TPS.
|
L'utilisateur <%= @invite.email_sender %> souhaite que vous participiez à l'élaboration d'un dossier sur la plateforme TPS.
|
||||||
Ce dossier se nomme : <%= @invite.dossier.nom_projet %>
|
|
||||||
|
|
||||||
Pour le consulter, merci de suivre ce lien : <%= users_dossiers_invite_url(@invite.id) %>
|
Pour le consulter, merci de suivre ce lien : <%= users_dossiers_invite_url(@invite.id) %>
|
||||||
|
|
||||||
|
|
|
@ -3,15 +3,8 @@
|
||||||
= @dossier.procedure.libelle
|
= @dossier.procedure.libelle
|
||||||
%h3 Votre dossier
|
%h3 Votre dossier
|
||||||
|
|
||||||
%br
|
|
||||||
|
|
||||||
-#TODO use form_for
|
-#TODO use form_for
|
||||||
= form_tag(url_for({controller: 'users/description', action: :create, dossier_id: @dossier.id}), class: 'form-inline', method: 'POST', multipart: true) do
|
= form_tag(url_for({controller: 'users/description', action: :create, dossier_id: @dossier.id}), class: 'form-inline', method: 'POST', multipart: true) do
|
||||||
%div
|
|
||||||
.row
|
|
||||||
.col-md-12
|
|
||||||
%h4 Libellé pour votre dossier *
|
|
||||||
= text_field_tag :nom_projet, @dossier.nom_projet, placeholder: 'Nom du projet', class: 'form-control'
|
|
||||||
|
|
||||||
#liste_champs
|
#liste_champs
|
||||||
-unless @champs.nil?
|
-unless @champs.nil?
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
%table.table
|
%table.table
|
||||||
%thead
|
%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 'Procédure', 'procedure.libelle'
|
||||||
%th.col-md-4.col-lg-4= smart_listing.sortable 'Nom du Projet', 'nom_projet'
|
%th.col-md-4.col-lg-4= smart_listing.sortable 'Raison sociale', 'entreprise.raison_sociale'
|
||||||
%th.col-md-2.col-lg-2= smart_listing.sortable 'État', 'state'
|
%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'
|
%th.col-md-2.col-lg-2= smart_listing.sortable 'Date de mise à jour', 'updated_at'
|
||||||
- @dossiers.each do |dossier|
|
- @dossiers.each do |dossier|
|
||||||
|
@ -15,8 +15,8 @@
|
||||||
%td
|
%td
|
||||||
= dossier.procedure.libelle
|
= dossier.procedure.libelle
|
||||||
%td
|
%td
|
||||||
= link_to(dossier.nom_projet, users_dossiers_invite_path(id: invite.id)) unless invite.nil?
|
= link_to(dossier.entreprise.raison_sociale, users_dossiers_invite_path(id: invite.id)) unless invite.nil?
|
||||||
= link_to(dossier.nom_projet, users_dossier_recapitulatif_path(dossier)) if invite.nil?
|
= link_to(dossier.entreprise.raison_sociale, users_dossier_recapitulatif_path(dossier)) if invite.nil?
|
||||||
|
|
||||||
%td{id: "dossier_#{dossier.id}_state"}= dossier.display_state
|
%td{id: "dossier_#{dossier.id}_state"}= dossier.display_state
|
||||||
%td= dossier.last_update
|
%td= dossier.last_update
|
||||||
|
|
|
@ -36,7 +36,7 @@ Rails.application.configure do
|
||||||
# Raises helpful error messages.
|
# Raises helpful error messages.
|
||||||
config.assets.raise_runtime_errors = true
|
config.assets.raise_runtime_errors = true
|
||||||
|
|
||||||
config.action_mailer.delivery_method = :mailjet
|
config.action_mailer.delivery_method = :test
|
||||||
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
|
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
|
||||||
|
|
||||||
# Raises error for missing translations
|
# Raises error for missing translations
|
||||||
|
|
|
@ -4,8 +4,6 @@ fr:
|
||||||
dossier: 'Dossier'
|
dossier: 'Dossier'
|
||||||
attributes:
|
attributes:
|
||||||
dossier:
|
dossier:
|
||||||
nom_projet: 'Le nom du projet'
|
|
||||||
description: 'La description'
|
|
||||||
montant_projet: 'Le montant du projet'
|
montant_projet: 'Le montant du projet'
|
||||||
montant_aide_demande: "Le montant d'aide demandée"
|
montant_aide_demande: "Le montant d'aide demandée"
|
||||||
date_previsionnelle: "La date de début prévisionnelle"
|
date_previsionnelle: "La date de début prévisionnelle"
|
||||||
|
|
|
@ -52,9 +52,8 @@ 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) }
|
||||||
it { expect(subject[:nom_projet]).to eq(dossier.nom_projet) }
|
|
||||||
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") }
|
||||||
it { expect(subject.keys.size).to eq(3) }
|
it { expect(subject.keys.size).to eq(2) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -116,14 +115,13 @@ describe API::V1::DossiersController do
|
||||||
let!(:dossier) { Timecop.freeze(date_creation) { create(:dossier, :with_entreprise, procedure: procedure) } }
|
let!(:dossier) { Timecop.freeze(date_creation) { create(:dossier, :with_entreprise, procedure: procedure) } }
|
||||||
let(:dossier_id) { dossier.id }
|
let(:dossier_id) { dossier.id }
|
||||||
let(:body) { JSON.parse(retour.body, symbolize_names: true) }
|
let(:body) { JSON.parse(retour.body, symbolize_names: true) }
|
||||||
let(:field_list) { [:id, :nom_projet, :created_at, :updated_at, :archived, :mandataire_social, :entreprise, :etablissement, :cerfa, :types_de_piece_justificative, :pieces_justificatives, :champs, :commentaires, :state] }
|
let(:field_list) { [:id, :created_at, :updated_at, :archived, :mandataire_social, :entreprise, :etablissement, :cerfa, :types_de_piece_justificative, :pieces_justificatives, :champs, :commentaires, :state] }
|
||||||
subject { body[:dossier] }
|
subject { body[:dossier] }
|
||||||
|
|
||||||
it 'return REST code 200', :show_in_doc do
|
it 'return REST code 200', :show_in_doc do
|
||||||
expect(retour.code).to eq('200')
|
expect(retour.code).to eq('200')
|
||||||
end
|
end
|
||||||
it { expect(subject[:id]).to eq(dossier.id) }
|
it { expect(subject[:id]).to eq(dossier.id) }
|
||||||
it { expect(subject[:nom_projet]).to eq(dossier.nom_projet) }
|
|
||||||
it { expect(subject[:state]).to eq(dossier.state) }
|
it { expect(subject[:state]).to eq(dossier.state) }
|
||||||
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') }
|
||||||
|
@ -231,7 +229,7 @@ describe API::V1::DossiersController do
|
||||||
it { expect(subject[:libelle]).to eq('Description') }
|
it { expect(subject[:libelle]).to eq('Description') }
|
||||||
it { expect(subject[:description]).to eq('description de votre projet') }
|
it { expect(subject[:description]).to eq('description de votre projet') }
|
||||||
it { expect(subject.keys.include?(:order_place)).to be_truthy }
|
it { expect(subject.keys.include?(:order_place)).to be_truthy }
|
||||||
it { expect(subject[:type]).to eq('textarea') }
|
it { expect(subject[:type]).to eq('text') }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,7 +20,7 @@ describe Backoffice::CommentairesController, type: :controller do
|
||||||
subject { post :create, dossier_id: dossier_id, email_commentaire: email_commentaire, texte_commentaire: texte_commentaire }
|
subject { post :create, dossier_id: dossier_id, email_commentaire: email_commentaire, texte_commentaire: texte_commentaire }
|
||||||
|
|
||||||
it 'depuis la page admin' do
|
it 'depuis la page admin' do
|
||||||
expect(response).to redirect_to("/backoffice/dossiers/#{dossier_id}")
|
expect(subject).to redirect_to("/backoffice/dossiers/#{dossier_id}")
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'gestionnaire is automatically affect to follow the dossier' do
|
it 'gestionnaire is automatically affect to follow the dossier' do
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe Backoffice::DossiersController, type: :controller do
|
describe Backoffice::DossiersController, type: :controller do
|
||||||
|
before do
|
||||||
|
@request.env['HTTP_REFERER'] = TPS::Application::URL
|
||||||
|
end
|
||||||
|
|
||||||
let(:dossier) { create(:dossier, :with_entreprise) }
|
let(:dossier) { create(:dossier, :with_entreprise) }
|
||||||
let(:dossier_archived) { create(:dossier, :with_entreprise, archived: true) }
|
let(:dossier_archived) { create(:dossier, :with_entreprise, archived: true) }
|
||||||
|
|
||||||
|
@ -67,19 +71,6 @@ describe Backoffice::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'GET #suivi' do
|
|
||||||
context 'when gestionnaire is connected' do
|
|
||||||
before do
|
|
||||||
sign_in gestionnaire
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'returns http success' do
|
|
||||||
get :index, liste: :suivi
|
|
||||||
expect(response).to have_http_status(200)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'GET #termine' do
|
describe 'GET #termine' do
|
||||||
context 'when gestionnaire is connected' do
|
context 'when gestionnaire is connected' do
|
||||||
before do
|
before do
|
||||||
|
@ -150,7 +141,6 @@ describe Backoffice::DossiersController, type: :controller do
|
||||||
subject { put :follow, dossier_id: dossier_id }
|
subject { put :follow, dossier_id: dossier_id }
|
||||||
|
|
||||||
it { expect(subject.status).to eq 302 }
|
it { expect(subject.status).to eq 302 }
|
||||||
it { is_expected.to redirect_to backoffice_dossiers_path }
|
|
||||||
|
|
||||||
describe 'flash alert' do
|
describe 'flash alert' do
|
||||||
context 'when dossier is not follow by gestionnaire' do
|
context 'when dossier is not follow by gestionnaire' do
|
||||||
|
|
|
@ -63,14 +63,13 @@ describe Users::DescriptionController, type: :controller, vcr: {cassette_name: '
|
||||||
|
|
||||||
describe 'POST #create' do
|
describe 'POST #create' do
|
||||||
let(:timestamp) { Time.now }
|
let(:timestamp) { Time.now }
|
||||||
let(:nom_projet) { 'Projet de test' }
|
|
||||||
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.' }
|
||||||
|
|
||||||
context 'Tous les attributs sont bons' do
|
context 'Tous les attributs sont bons' do
|
||||||
describe 'Premier enregistrement des données' do
|
describe 'Premier enregistrement des données' do
|
||||||
before do
|
before do
|
||||||
dossier.draft!
|
dossier.draft!
|
||||||
post :create, dossier_id: dossier_id, nom_projet: nom_projet
|
post :create, dossier_id: dossier_id
|
||||||
dossier.reload
|
dossier.reload
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -78,8 +77,6 @@ describe Users::DescriptionController, type: :controller, vcr: {cassette_name: '
|
||||||
expect(response).to redirect_to("/users/dossiers/#{dossier_id}/recapitulatif")
|
expect(response).to redirect_to("/users/dossiers/#{dossier_id}/recapitulatif")
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(dossier.nom_projet).to eq nom_projet }
|
|
||||||
|
|
||||||
it 'etat du dossier est soumis' do
|
it 'etat du dossier est soumis' do
|
||||||
expect(dossier.state).to eq('initiated')
|
expect(dossier.state).to eq('initiated')
|
||||||
end
|
end
|
||||||
|
@ -88,7 +85,7 @@ describe Users::DescriptionController, type: :controller, vcr: {cassette_name: '
|
||||||
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, dossier_id: dossier_id, nom_projet: nom_projet, description: description
|
post :create, dossier_id: dossier_id
|
||||||
dossier.reload
|
dossier.reload
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -102,28 +99,10 @@ describe Users::DescriptionController, type: :controller, vcr: {cassette_name: '
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'Attribut(s) manquant(s)' do
|
|
||||||
subject {
|
|
||||||
post :create,
|
|
||||||
dossier_id: dossier_id,
|
|
||||||
nom_projet: nom_projet,
|
|
||||||
description: description
|
|
||||||
}
|
|
||||||
before { subject }
|
|
||||||
|
|
||||||
context 'nom_projet empty' do
|
|
||||||
let(:nom_projet) { '' }
|
|
||||||
it { is_expected.to render_template(:show) }
|
|
||||||
it { expect(flash[:alert]).to be_present }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'Quand la procédure accepte les CERFA' do
|
context 'Quand la procédure accepte les CERFA' 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, dossier_id: dossier_id,
|
post :create, dossier_id: dossier_id,
|
||||||
nom_projet: nom_projet,
|
|
||||||
description: description,
|
|
||||||
cerfa_pdf: cerfa_pdf
|
cerfa_pdf: cerfa_pdf
|
||||||
dossier.reload
|
dossier.reload
|
||||||
end
|
end
|
||||||
|
@ -150,7 +129,7 @@ describe Users::DescriptionController, type: :controller, vcr: {cassette_name: '
|
||||||
let(:cerfas) { Cerfa.where(dossier_id: dossier_id) }
|
let(:cerfas) { Cerfa.where(dossier_id: dossier_id) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
post :create, dossier_id: dossier_id, nom_projet: nom_projet, description: description, cerfa_pdf: cerfa_pdf
|
post :create, 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
|
||||||
|
@ -165,8 +144,6 @@ describe Users::DescriptionController, type: :controller, vcr: {cassette_name: '
|
||||||
let!(:procedure) { create(:procedure) }
|
let!(:procedure) { create(:procedure) }
|
||||||
before do
|
before do
|
||||||
post :create, dossier_id: dossier_id,
|
post :create, dossier_id: dossier_id,
|
||||||
nom_projet: nom_projet,
|
|
||||||
description: description,
|
|
||||||
cerfa_pdf: cerfa_pdf
|
cerfa_pdf: cerfa_pdf
|
||||||
dossier.reload
|
dossier.reload
|
||||||
end
|
end
|
||||||
|
@ -186,8 +163,6 @@ describe Users::DescriptionController, type: :controller, vcr: {cassette_name: '
|
||||||
|
|
||||||
before do
|
before do
|
||||||
post :create, {dossier_id: dossier_id,
|
post :create, {dossier_id: dossier_id,
|
||||||
nom_projet: nom_projet,
|
|
||||||
description: description,
|
|
||||||
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
|
||||||
|
@ -228,8 +203,6 @@ describe Users::DescriptionController, type: :controller, vcr: {cassette_name: '
|
||||||
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, {dossier_id: dossier_id,
|
post :create, {dossier_id: dossier_id,
|
||||||
nom_projet: nom_projet,
|
|
||||||
description: description,
|
|
||||||
'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
|
||||||
|
@ -240,8 +213,6 @@ describe Users::DescriptionController, type: :controller, vcr: {cassette_name: '
|
||||||
expect(ClamavService).to receive(:safe_file?).twice
|
expect(ClamavService).to receive(:safe_file?).twice
|
||||||
|
|
||||||
post :create, {dossier_id: dossier_id,
|
post :create, {dossier_id: dossier_id,
|
||||||
nom_projet: nom_projet,
|
|
||||||
description: description,
|
|
||||||
'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
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
FactoryGirl.define do
|
FactoryGirl.define do
|
||||||
factory :dossier do
|
factory :dossier do
|
||||||
nom_projet "Demande de subvention dans le cadre d'accompagnement d'enfant à l'étranger"
|
|
||||||
state 'draft'
|
state 'draft'
|
||||||
association :user, factory: [:user]
|
association :user, factory: [:user]
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ FactoryGirl.define do
|
||||||
factory :type_de_champ do
|
factory :type_de_champ do
|
||||||
libelle 'Description'
|
libelle 'Description'
|
||||||
description 'description de votre projet'
|
description 'description de votre projet'
|
||||||
type_champ 'textarea'
|
type_champ 'text'
|
||||||
order_place 1
|
order_place 1
|
||||||
mandatory false
|
mandatory false
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,7 @@ feature 'on backoffice page' do
|
||||||
let(:gestionnaire) { create(:gestionnaire, administrateurs: [administrateur]) }
|
let(:gestionnaire) { create(:gestionnaire, administrateurs: [administrateur]) }
|
||||||
let(:procedure) { create(:procedure, administrateur: administrateur) }
|
let(:procedure) { create(:procedure, administrateur: administrateur) }
|
||||||
|
|
||||||
let!(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated') }
|
let!(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated') }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
create :assign_to, gestionnaire: gestionnaire, procedure: procedure
|
create :assign_to, gestionnaire: gestionnaire, procedure: procedure
|
||||||
|
@ -20,7 +20,7 @@ feature 'on backoffice page' do
|
||||||
end
|
end
|
||||||
context 'when he click on first dossier' do
|
context 'when he click on first dossier' do
|
||||||
before do
|
before do
|
||||||
page.click_on dossier.nom_projet
|
page.click_on dossier.entreprise.raison_sociale
|
||||||
end
|
end
|
||||||
scenario 'it redirect to dossier page' do
|
scenario 'it redirect to dossier page' do
|
||||||
expect(page).to have_css('#backoffice_dossier_show')
|
expect(page).to have_css('#backoffice_dossier_show')
|
||||||
|
|
|
@ -40,13 +40,11 @@ feature 'search file on gestionnaire backoffice' do
|
||||||
|
|
||||||
context 'when terms input does return result' do
|
context 'when terms input does return result' do
|
||||||
let!(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated') }
|
let!(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated') }
|
||||||
let!(:dossier_2) { create(:dossier, procedure: procedure, state: 'initiated', nom_projet: 'Projet de test') }
|
let!(:dossier_2) { create(:dossier, procedure: procedure, state: 'initiated') }
|
||||||
|
|
||||||
let(:terms) { dossier.nom_projet }
|
let(:terms) { dossier.entreprise.raison_sociale }
|
||||||
|
|
||||||
it { expect(page).not_to have_content('Projet de test') }
|
it { expect(page).to have_content(dossier.entreprise.raison_sociale) }
|
||||||
|
|
||||||
it { expect(page).to have_content(dossier.nom_projet) }
|
|
||||||
|
|
||||||
context "when terms is a file's id" do
|
context "when terms is a file's id" do
|
||||||
let(:terms) { dossier.id }
|
let(:terms) { dossier.id }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
feature 'user is on description page' do
|
feature 'user is on description page' do
|
||||||
let!(:procedure) { create(:procedure, :with_two_type_de_piece_justificative, cerfa_flag: true) }
|
let!(:procedure) { create(:procedure, :with_two_type_de_piece_justificative, :with_type_de_champ, cerfa_flag: true) }
|
||||||
let!(:dossier) { create(:dossier, :with_entreprise, procedure: procedure) }
|
let!(:dossier) { create(:dossier, :with_entreprise, procedure: procedure) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
@ -21,7 +21,7 @@ feature 'user is on description page' do
|
||||||
|
|
||||||
context 'he fill description fields' do
|
context 'he fill description fields' do
|
||||||
before do
|
before do
|
||||||
find_by_id('nom_projet').set 'mon nom'
|
find_by_id("champs_#{dossier.champs.first.id}").set 'mon nom'
|
||||||
end
|
end
|
||||||
context 'before submit' do
|
context 'before submit' do
|
||||||
it 'dossier cerfa is empty' do
|
it 'dossier cerfa is empty' do
|
||||||
|
|
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
||||||
|
|
||||||
feature 'user path for dossier creation' do
|
feature 'user path for dossier creation' do
|
||||||
let(:user) { create(:user) }
|
let(:user) { create(:user) }
|
||||||
let(:procedure) { create(:procedure, :published) }
|
let(:procedure) { create(:procedure, :published, :with_type_de_champ) }
|
||||||
let(:siret) { '53272417600013' }
|
let(:siret) { '53272417600013' }
|
||||||
let(:siren) { siret[0...9] }
|
let(:siren) { siret[0...9] }
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ feature 'user path for dossier creation' do
|
||||||
end
|
end
|
||||||
context 'user fill and validate description page' do
|
context 'user fill and validate description page' do
|
||||||
before do
|
before do
|
||||||
page.find_by_id('nom_projet').set 'Mon super projet'
|
page.find_by_id("champs_#{Dossier.last.champs.first.id}").set 'Mon super projet'
|
||||||
page.click_on 'Soumettre mon dossier'
|
page.click_on 'Soumettre mon dossier'
|
||||||
end
|
end
|
||||||
scenario 'user is on recap page' do
|
scenario 'user is on recap page' do
|
||||||
|
|
|
@ -3,12 +3,15 @@ require 'spec_helper'
|
||||||
feature 'user access to the list of his dossier' do
|
feature 'user access to the list of his dossier' do
|
||||||
|
|
||||||
let(:user) { create(:user) }
|
let(:user) { create(:user) }
|
||||||
let!(:last_updated_dossier) { create(:dossier, user: user, state: 'replied')}
|
let!(:last_updated_dossier) { create(:dossier, :with_entreprise, user: user, state: 'replied')}
|
||||||
let!(:dossier1) { create(:dossier, user: user, nom_projet: 'mon permier dossier', state: 'replied') }
|
let!(:dossier1) { create(:dossier, :with_entreprise, user: user, state: 'replied') }
|
||||||
let!(:dossier2) { create(:dossier, nom_projet: 'mon deuxième dossier') }
|
let!(:dossier2) { create(:dossier, :with_entreprise) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
last_updated_dossier.update_attributes(nom_projet: 'salut la compagnie')
|
dossier1.update_column(:updated_at, "19/07/2016 15:35".to_time)
|
||||||
|
dossier1.entreprise.update_column(:raison_sociale, 'PLOP')
|
||||||
|
last_updated_dossier.entreprise.update_column(:raison_sociale, 'PLIP')
|
||||||
|
|
||||||
visit new_user_session_path
|
visit new_user_session_path
|
||||||
within('#new_user') do
|
within('#new_user') do
|
||||||
page.find_by_id('user_email').set user.email
|
page.find_by_id('user_email').set user.email
|
||||||
|
@ -17,12 +20,12 @@ feature 'user access to the list of his dossier' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
scenario 'the list of dossier is displayed' do
|
scenario 'the list of dossier is displayed' do
|
||||||
expect(page).to have_content(dossier1.nom_projet)
|
expect(page).to have_content(dossier1.entreprise.raison_sociale)
|
||||||
expect(page).not_to have_content(dossier2.nom_projet)
|
expect(page).not_to have_content(dossier2.entreprise.raison_sociale)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'the list must be order by last updated' do
|
scenario 'the list must be order by last updated' do
|
||||||
expect(page.body).to match(/#{last_updated_dossier.nom_projet}.*#{dossier1.nom_projet}/m)
|
expect(page.body).to match(/#{last_updated_dossier.entreprise.raison_sociale}.*#{dossier1.entreprise.raison_sociale}/m)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'the state of dossier is displayed' do
|
scenario 'the state of dossier is displayed' do
|
||||||
|
@ -31,7 +34,7 @@ feature 'user access to the list of his dossier' do
|
||||||
|
|
||||||
context 'when user clicks on a projet in list' do
|
context 'when user clicks on a projet in list' do
|
||||||
before do
|
before do
|
||||||
page.click_on dossier1.nom_projet
|
page.click_on dossier1.entreprise.raison_sociale
|
||||||
end
|
end
|
||||||
scenario 'user is redirected to dossier page' do
|
scenario 'user is redirected to dossier page' do
|
||||||
expect(page).to have_css('#recap_dossier')
|
expect(page).to have_css('#recap_dossier')
|
||||||
|
|
|
@ -34,14 +34,6 @@ describe Dossier do
|
||||||
it { is_expected.to delegate_method(:types_de_champ).to(:procedure) }
|
it { is_expected.to delegate_method(:types_de_champ).to(:procedure) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'validation' do
|
|
||||||
context 'nom_projet' do
|
|
||||||
it { is_expected.to allow_value(nil).for(:nom_projet) }
|
|
||||||
it { is_expected.not_to allow_value('').for(:nom_projet) }
|
|
||||||
it { is_expected.to allow_value('mon super projet').for(:nom_projet) }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'methods' do
|
describe 'methods' do
|
||||||
let(:dossier) { create(:dossier, :with_entreprise, user: user) }
|
let(:dossier) { create(:dossier, :with_entreprise, user: user) }
|
||||||
|
|
||||||
|
@ -122,7 +114,7 @@ describe Dossier do
|
||||||
|
|
||||||
it 'does not create default champs' do
|
it 'does not create default champs' do
|
||||||
expect(subject).not_to receive(:build_default_champs)
|
expect(subject).not_to receive(:build_default_champs)
|
||||||
subject.update_attributes(nom_projet: 'plop')
|
subject.update_attributes(state: 'initiated')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -443,11 +435,11 @@ describe Dossier do
|
||||||
let(:procedure_1) { create(:procedure, administrateur: administrateur_1) }
|
let(:procedure_1) { create(:procedure, administrateur: administrateur_1) }
|
||||||
let(:procedure_2) { create(:procedure, administrateur: administrateur_2) }
|
let(:procedure_2) { create(:procedure, administrateur: administrateur_2) }
|
||||||
|
|
||||||
let!(:dossier_0) { create(:dossier, nom_projet: 'je suis un brouillon', state: 'draft', procedure: procedure_1, user: create(:user, email: 'brouillon@clap.fr')) }
|
let!(:dossier_0) { create(:dossier, state: 'draft', procedure: procedure_1, user: create(:user, email: 'brouillon@clap.fr')) }
|
||||||
let!(:dossier_1) { create(:dossier, nom_projet: 'Projet de test', state: 'initiated', procedure: procedure_1, user: create(:user, email: 'contact@test.com')) }
|
let!(:dossier_1) { create(:dossier, state: 'initiated', procedure: procedure_1, user: create(:user, email: 'contact@test.com')) }
|
||||||
let!(:dossier_2) { create(:dossier, nom_projet: 'Lili et Marcel', state: 'initiated', procedure: procedure_1, user: create(:user, email: 'plop@gmail.com')) }
|
let!(:dossier_2) { create(:dossier, state: 'initiated', procedure: procedure_1, user: create(:user, email: 'plop@gmail.com')) }
|
||||||
let!(:dossier_3) { create(:dossier, nom_projet: 'Construction projet marcel', state: 'initiated', procedure: procedure_2, user: create(:user, email: 'peace@clap.fr')) }
|
let!(:dossier_3) { create(:dossier, state: 'initiated', procedure: procedure_2, user: create(:user, email: 'peace@clap.fr')) }
|
||||||
let!(:dossier_archived) { create(:dossier, nom_projet: 'je suis un Marcel archivé', state: 'initiated', procedure: procedure_1, archived: true, user: create(:user, email: 'brouillonArchived@clap.fr')) }
|
let!(:dossier_archived) { create(:dossier, state: 'initiated', procedure: procedure_1, archived: true, user: create(:user, email: 'brouillonArchived@clap.fr')) }
|
||||||
|
|
||||||
let!(:etablissement_1) { create(:etablissement, entreprise: create(:entreprise, raison_sociale: 'OCTO Academy', dossier: dossier_1), dossier: dossier_1, siret: '41636169600051') }
|
let!(:etablissement_1) { create(:etablissement, entreprise: create(:entreprise, raison_sociale: 'OCTO Academy', dossier: dossier_1), dossier: dossier_1, siret: '41636169600051') }
|
||||||
let!(:etablissement_2) { create(:etablissement, entreprise: create(:entreprise, raison_sociale: 'Plop octo', dossier: dossier_2), dossier: dossier_2, siret: '41816602300012') }
|
let!(:etablissement_2) { create(:etablissement, entreprise: create(:entreprise, raison_sociale: 'Plop octo', dossier: dossier_2), dossier: dossier_2, siret: '41816602300012') }
|
||||||
|
@ -465,12 +457,6 @@ describe Dossier do
|
||||||
it { expect(subject.size).to eq(0) }
|
it { expect(subject.size).to eq(0) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'search on file title' do
|
|
||||||
let(:terms) { 'Marcel' }
|
|
||||||
|
|
||||||
it { expect(subject.size).to eq(1) }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'search on contact email' do
|
describe 'search on contact email' do
|
||||||
let(:terms) { 'clap' }
|
let(:terms) { 'clap' }
|
||||||
|
|
||||||
|
@ -536,7 +522,6 @@ describe Dossier do
|
||||||
let(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure) }
|
let(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure) }
|
||||||
subject { dossier.as_csv }
|
subject { dossier.as_csv }
|
||||||
|
|
||||||
it { expect(subject[:nom_projet]).to eq("Demande de subvention dans le cadre d'accompagnement d'enfant à l'étranger") }
|
|
||||||
it { expect(subject[:archived]).to be_falsey }
|
it { expect(subject[:archived]).to be_falsey }
|
||||||
it { expect(subject['etablissement.siret']).to eq('44011762001530') }
|
it { expect(subject['etablissement.siret']).to eq('44011762001530') }
|
||||||
it { expect(subject['etablissement.siege_social']).to be_truthy }
|
it { expect(subject['etablissement.siege_social']).to be_truthy }
|
||||||
|
|
|
@ -21,10 +21,6 @@ describe 'admin/previsualisations/show.html.haml', type: :view do
|
||||||
expect(rendered).to have_selector("form[action='/users/dossiers/#{dossier_id}/description'][method=post]")
|
expect(rendered).to have_selector("form[action='/users/dossiers/#{dossier_id}/description'][method=post]")
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'Nom du projet' do
|
|
||||||
expect(rendered).to have_selector('input[id=nom_projet][name=nom_projet]')
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'Charger votre CERFA (PDF)' do
|
it 'Charger votre CERFA (PDF)' do
|
||||||
expect(rendered).to have_selector('input[type=file][name=cerfa_pdf][id=cerfa_pdf]')
|
expect(rendered).to have_selector('input[type=file][name=cerfa_pdf][id=cerfa_pdf]')
|
||||||
end
|
end
|
||||||
|
@ -66,17 +62,12 @@ describe 'admin/previsualisations/show.html.haml', type: :view do
|
||||||
context 'les valeurs sont réaffichées si elles sont présentes dans la BDD' do
|
context 'les valeurs sont réaffichées si elles sont présentes dans la BDD' do
|
||||||
let!(:dossier) do
|
let!(:dossier) do
|
||||||
create(:dossier,
|
create(:dossier,
|
||||||
nom_projet: 'Projet de test',
|
|
||||||
user: user)
|
user: user)
|
||||||
end
|
end
|
||||||
|
|
||||||
before do
|
before do
|
||||||
render
|
render
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'Nom du projet' do
|
|
||||||
expect(rendered).to have_selector("input[id=nom_projet][value='#{dossier.nom_projet}']")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'Champs' do
|
context 'Champs' do
|
||||||
|
|
|
@ -6,12 +6,17 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
|
||||||
|
|
||||||
let!(:procedure) { create(:procedure, administrateur: administrateur) }
|
let!(:procedure) { create(:procedure, administrateur: administrateur) }
|
||||||
|
|
||||||
let!(:decorate_dossier_initiated) { create(:dossier, procedure: procedure, nom_projet: 'projet initiated', state: 'initiated').decorate }
|
let!(:decorate_dossier_initiated) { create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated').decorate }
|
||||||
let!(:decorate_dossier_replied) { create(:dossier, procedure: procedure, nom_projet: 'projet replied', state: 'replied').decorate }
|
let!(:decorate_dossier_replied) { create(:dossier, :with_entreprise, procedure: procedure, state: 'replied').decorate }
|
||||||
let!(:decorate_dossier_closed) { create(:dossier, procedure: procedure, nom_projet: 'projet closed', state: 'closed').decorate }
|
let!(:decorate_dossier_closed) { create(:dossier, :with_entreprise, procedure: procedure, state: 'closed').decorate }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
|
||||||
|
decorate_dossier_closed.entreprise.update_column(:raison_sociale, 'plip')
|
||||||
|
decorate_dossier_replied.entreprise.update_column(:raison_sociale, 'plop')
|
||||||
|
|
||||||
create :assign_to, gestionnaire: gestionnaire, procedure: procedure
|
create :assign_to, gestionnaire: gestionnaire, procedure: procedure
|
||||||
|
sign_in gestionnaire
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'on tab a_traiter' do
|
describe 'on tab a_traiter' do
|
||||||
|
@ -29,12 +34,12 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
|
||||||
subject { rendered }
|
subject { rendered }
|
||||||
it { is_expected.to have_css('#backoffice_index') }
|
it { is_expected.to have_css('#backoffice_index') }
|
||||||
it { is_expected.to have_content(procedure.libelle) }
|
it { is_expected.to have_content(procedure.libelle) }
|
||||||
it { is_expected.to have_content(decorate_dossier_initiated.nom_projet) }
|
it { is_expected.to have_content(decorate_dossier_initiated.entreprise.raison_sociale) }
|
||||||
it { is_expected.to have_content(decorate_dossier_initiated.display_state) }
|
it { is_expected.to have_content(decorate_dossier_initiated.display_state) }
|
||||||
it { is_expected.to have_content(decorate_dossier_initiated.last_update) }
|
it { is_expected.to have_content(decorate_dossier_initiated.last_update) }
|
||||||
|
|
||||||
it { is_expected.not_to have_content(decorate_dossier_replied.nom_projet) }
|
it { is_expected.not_to have_content(decorate_dossier_replied.entreprise.raison_sociale) }
|
||||||
it { is_expected.not_to have_content(decorate_dossier_closed.nom_projet) }
|
it { is_expected.not_to have_content(decorate_dossier_closed.entreprise.raison_sociale) }
|
||||||
|
|
||||||
it { is_expected.to have_css("#suivre_dossier_#{gestionnaire.dossiers.waiting_for_gestionnaire.first.id}") }
|
it { is_expected.to have_css("#suivre_dossier_#{gestionnaire.dossiers.waiting_for_gestionnaire.first.id}") }
|
||||||
|
|
||||||
|
@ -58,12 +63,12 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
|
||||||
subject { rendered }
|
subject { rendered }
|
||||||
it { is_expected.to have_css('#backoffice_index') }
|
it { is_expected.to have_css('#backoffice_index') }
|
||||||
it { is_expected.to have_content(procedure.libelle) }
|
it { is_expected.to have_content(procedure.libelle) }
|
||||||
it { is_expected.to have_content(decorate_dossier_replied.nom_projet) }
|
it { is_expected.to have_content(decorate_dossier_replied.entreprise.raison_sociale) }
|
||||||
it { is_expected.to have_content(decorate_dossier_replied.display_state) }
|
it { is_expected.to have_content(decorate_dossier_replied.display_state) }
|
||||||
it { is_expected.to have_content(decorate_dossier_replied.last_update) }
|
it { is_expected.to have_content(decorate_dossier_replied.last_update) }
|
||||||
|
|
||||||
it { is_expected.not_to have_content(decorate_dossier_initiated.nom_projet) }
|
it { is_expected.not_to have_content(decorate_dossier_initiated.entreprise.raison_sociale) }
|
||||||
it { is_expected.not_to have_content(decorate_dossier_closed.nom_projet) }
|
it { is_expected.not_to have_content(decorate_dossier_closed.entreprise.raison_sociale) }
|
||||||
|
|
||||||
describe 'active tab' do
|
describe 'active tab' do
|
||||||
it { is_expected.to have_selector('.active .text-info') }
|
it { is_expected.to have_selector('.active .text-info') }
|
||||||
|
@ -85,12 +90,12 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
|
||||||
|
|
||||||
it { is_expected.to have_css('#backoffice_index') }
|
it { is_expected.to have_css('#backoffice_index') }
|
||||||
it { is_expected.to have_content(procedure.libelle) }
|
it { is_expected.to have_content(procedure.libelle) }
|
||||||
it { is_expected.to have_content(decorate_dossier_closed.nom_projet) }
|
it { is_expected.to have_content(decorate_dossier_closed.entreprise.raison_sociale) }
|
||||||
it { is_expected.to have_content(decorate_dossier_closed.display_state) }
|
it { is_expected.to have_content(decorate_dossier_closed.display_state) }
|
||||||
it { is_expected.to have_content(decorate_dossier_closed.last_update) }
|
it { is_expected.to have_content(decorate_dossier_closed.last_update) }
|
||||||
|
|
||||||
it { is_expected.not_to have_content(decorate_dossier_initiated.nom_projet) }
|
it { is_expected.not_to have_content(decorate_dossier_initiated.entreprise.raison_sociale) }
|
||||||
it { is_expected.not_to have_content(decorate_dossier_replied.nom_projet) }
|
it { is_expected.not_to have_content(decorate_dossier_replied.entreprise.raison_sociale) }
|
||||||
|
|
||||||
it { is_expected.not_to have_css("#suivre_dossier_#{gestionnaire.dossiers.termine.first.id}") }
|
it { is_expected.not_to have_css("#suivre_dossier_#{gestionnaire.dossiers.termine.first.id}") }
|
||||||
|
|
||||||
|
|
|
@ -22,10 +22,6 @@ describe 'users/description/show.html.haml', type: :view do
|
||||||
expect(rendered).to have_selector("form[action='/users/dossiers/#{dossier_id}/description'][method=post]")
|
expect(rendered).to have_selector("form[action='/users/dossiers/#{dossier_id}/description'][method=post]")
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'Nom du projet' do
|
|
||||||
expect(rendered).to have_selector('input[id=nom_projet][name=nom_projet]')
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'Charger votre CERFA (PDF)' do
|
it 'Charger votre CERFA (PDF)' do
|
||||||
expect(rendered).to have_selector('input[type=file][name=cerfa_pdf][id=cerfa_pdf]')
|
expect(rendered).to have_selector('input[type=file][name=cerfa_pdf][id=cerfa_pdf]')
|
||||||
end
|
end
|
||||||
|
@ -64,22 +60,6 @@ describe 'users/description/show.html.haml', type: :view do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'les valeurs sont réaffichées si elles sont présentes dans la BDD' do
|
|
||||||
let!(:dossier) do
|
|
||||||
create(:dossier,
|
|
||||||
nom_projet: 'Projet de test',
|
|
||||||
user: user)
|
|
||||||
end
|
|
||||||
|
|
||||||
before do
|
|
||||||
render
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'Nom du projet' do
|
|
||||||
expect(rendered).to have_selector("input[id=nom_projet][value='#{dossier.nom_projet}']")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'Champs' do
|
context 'Champs' do
|
||||||
let(:champs) { dossier.champs }
|
let(:champs) { dossier.champs }
|
||||||
let(:types_de_champ) { procedure.types_de_champ.where(type_champ: 'datetime').first }
|
let(:types_de_champ) { procedure.types_de_champ.where(type_champ: 'datetime').first }
|
||||||
|
|
|
@ -3,10 +3,17 @@ require 'spec_helper'
|
||||||
describe 'users/dossiers/index.html.haml', type: :view do
|
describe 'users/dossiers/index.html.haml', type: :view do
|
||||||
let(:user) { create(:user) }
|
let(:user) { create(:user) }
|
||||||
|
|
||||||
let!(:dossier) { create(:dossier, user: user, state: 'initiated', nom_projet: 'projet de test').decorate }
|
let!(:dossier) { create(:dossier, :with_entreprise, user: user, state: 'initiated').decorate }
|
||||||
let!(:dossier_2) { create(:dossier, user: user, state: 'replied', nom_projet: 'projet répondu').decorate }
|
let!(:dossier_2) { create(:dossier, :with_entreprise, user: user, state: 'replied').decorate }
|
||||||
let!(:dossier_3) { create(:dossier, user: user, state: 'replied', nom_projet: 'projet répondu 2').decorate }
|
let!(:dossier_3) { create(:dossier, :with_entreprise, user: user, state: 'replied').decorate }
|
||||||
let!(:dossier_termine) { create(:dossier, user: user, state: 'closed').decorate }
|
let!(:dossier_termine) { create(:dossier, :with_entreprise, user: user, state: 'closed').decorate }
|
||||||
|
|
||||||
|
before do
|
||||||
|
dossier_2.entreprise.update_column(:raison_sociale, 'plip')
|
||||||
|
dossier_2.entreprise.update_column(:raison_sociale, 'plop')
|
||||||
|
dossier_3.entreprise.update_column(:raison_sociale, 'plup')
|
||||||
|
dossier_termine.entreprise.update_column(:raison_sociale, 'plap')
|
||||||
|
end
|
||||||
|
|
||||||
describe 'params liste is a_traiter' do
|
describe 'params liste is a_traiter' do
|
||||||
let(:dossiers_list) { user.dossiers.waiting_for_user('DESC') }
|
let(:dossiers_list) { user.dossiers.waiting_for_user('DESC') }
|
||||||
|
@ -32,14 +39,14 @@ describe 'users/dossiers/index.html.haml', type: :view do
|
||||||
|
|
||||||
describe 'dossier replied is present' do
|
describe 'dossier replied is present' do
|
||||||
it { is_expected.to have_content(dossier_2.procedure.libelle) }
|
it { is_expected.to have_content(dossier_2.procedure.libelle) }
|
||||||
it { is_expected.to have_content(dossier_2.nom_projet) }
|
it { is_expected.to have_content(dossier_2.entreprise.raison_sociale) }
|
||||||
it { is_expected.to have_content(dossier_2.display_state) }
|
it { is_expected.to have_content(dossier_2.display_state) }
|
||||||
it { is_expected.to have_content(dossier_2.last_update) }
|
it { is_expected.to have_content(dossier_2.last_update) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'dossier initiated and closed are not present' do
|
describe 'dossier initiated and closed are not present' do
|
||||||
it { is_expected.not_to have_content(dossier.nom_projet) }
|
it { is_expected.not_to have_content(dossier.entreprise.raison_sociale) }
|
||||||
it { is_expected.not_to have_content(dossier_termine.nom_projet) }
|
it { is_expected.not_to have_content(dossier_termine.entreprise.raison_sociale) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'badges on tabs' do
|
describe 'badges on tabs' do
|
||||||
|
@ -69,14 +76,14 @@ describe 'users/dossiers/index.html.haml', type: :view do
|
||||||
|
|
||||||
describe 'dossier initiated is present' do
|
describe 'dossier initiated is present' do
|
||||||
it { is_expected.to have_content(dossier.procedure.libelle) }
|
it { is_expected.to have_content(dossier.procedure.libelle) }
|
||||||
it { is_expected.to have_content(dossier.nom_projet) }
|
it { is_expected.to have_content(dossier.entreprise.raison_sociale) }
|
||||||
it { is_expected.to have_content(dossier.display_state) }
|
it { is_expected.to have_content(dossier.display_state) }
|
||||||
it { is_expected.to have_content(dossier.last_update) }
|
it { is_expected.to have_content(dossier.last_update) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'dossier replied and closed are not present' do
|
describe 'dossier replied and closed are not present' do
|
||||||
it { is_expected.not_to have_content(dossier_2.nom_projet) }
|
it { is_expected.not_to have_content(dossier_2.entreprise.raison_sociale) }
|
||||||
it { is_expected.not_to have_content(dossier_termine.nom_projet) }
|
it { is_expected.not_to have_content(dossier_termine.entreprise.raison_sociale) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -100,14 +107,14 @@ describe 'users/dossiers/index.html.haml', type: :view do
|
||||||
|
|
||||||
describe 'dossier termine is present' do
|
describe 'dossier termine is present' do
|
||||||
it { is_expected.to have_content(dossier_termine.procedure.libelle) }
|
it { is_expected.to have_content(dossier_termine.procedure.libelle) }
|
||||||
it { is_expected.to have_content(dossier_termine.nom_projet) }
|
it { is_expected.to have_content(dossier_termine.entreprise.raison_sociale) }
|
||||||
it { is_expected.to have_content(dossier_termine.display_state) }
|
it { is_expected.to have_content(dossier_termine.display_state) }
|
||||||
it { is_expected.to have_content(dossier_termine.last_update) }
|
it { is_expected.to have_content(dossier_termine.last_update) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'dossier initiated and replied are not present' do
|
describe 'dossier initiated and replied are not present' do
|
||||||
it { is_expected.not_to have_content(dossier.nom_projet) }
|
it { is_expected.not_to have_content(dossier.entreprise.raison_sociale) }
|
||||||
it { is_expected.not_to have_content(dossier_2.nom_projet) }
|
it { is_expected.not_to have_content(dossier_2.entreprise.raison_sociale) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Reference in a new issue