Merge branch 'develop' of ssh://37.187.249.111:2200/opt/git/tps into develop
Conflicts: app/views/dossiers/_infos_dossier.html.haml
This commit is contained in:
commit
d034176fe3
24 changed files with 143 additions and 109 deletions
|
@ -24,7 +24,6 @@ describe DescriptionController, type: :controller do
|
|||
let(:montant_projet) { 12_000 }
|
||||
let(:montant_aide_demande) { 3000 }
|
||||
let(:date_previsionnelle) { '20/01/2016' }
|
||||
let(:mail_contact) { 'test@test.com' }
|
||||
|
||||
let(:name_piece_justificative) { 'dossierPDF.pdf' }
|
||||
let(:name_piece_justificative_0) { 'piece_justificative_0.pdf' }
|
||||
|
@ -37,14 +36,14 @@ describe DescriptionController, type: :controller do
|
|||
context 'Tous les attributs sont bons' do
|
||||
# TODO separer en deux tests : check donnees et check redirect
|
||||
it 'Premier enregistrement des données' do
|
||||
post :create, dossier_id: dossier_id, nom_projet: nom_projet, description: description, montant_projet: montant_projet, montant_aide_demande: montant_aide_demande, date_previsionnelle: date_previsionnelle, mail_contact: mail_contact
|
||||
post :create, dossier_id: dossier_id, nom_projet: nom_projet, description: description, montant_projet: montant_projet, montant_aide_demande: montant_aide_demande, date_previsionnelle: date_previsionnelle
|
||||
expect(response).to redirect_to("/dossiers/#{dossier_id}/recapitulatif")
|
||||
end
|
||||
|
||||
# TODO changer les valeurs des champs et check in bdd
|
||||
context 'En train de modifier les données de description du projet' do
|
||||
before do
|
||||
post :create, dossier_id: dossier_id, nom_projet: nom_projet, description: description, montant_projet: montant_projet, montant_aide_demande: montant_aide_demande, date_previsionnelle: date_previsionnelle, mail_contact: mail_contact, back_url: 'recapitulatif'
|
||||
post :create, dossier_id: dossier_id, nom_projet: nom_projet, description: description, montant_projet: montant_projet, montant_aide_demande: montant_aide_demande, date_previsionnelle: date_previsionnelle, back_url: 'recapitulatif'
|
||||
end
|
||||
|
||||
context 'Enregistrement d\'un commentaire informant la modification' do
|
||||
|
@ -77,8 +76,7 @@ describe DescriptionController, type: :controller do
|
|||
description: description,
|
||||
montant_projet: montant_projet,
|
||||
montant_aide_demande: montant_aide_demande,
|
||||
date_previsionnelle: date_previsionnelle,
|
||||
mail_contact: mail_contact
|
||||
date_previsionnelle: date_previsionnelle
|
||||
}
|
||||
before { subject }
|
||||
|
||||
|
@ -111,20 +109,6 @@ describe DescriptionController, type: :controller do
|
|||
it { is_expected.to render_template(:show) }
|
||||
it { expect(flash[:alert]).to be_present }
|
||||
end
|
||||
|
||||
it 'mail_contact manquant' do
|
||||
post :create, dossier_id: dossier_id, nom_projet: nom_projet, description: description, montant_projet: montant_projet, montant_aide_demande: montant_aide_demande, date_previsionnelle: date_previsionnelle, mail_contact: ''
|
||||
expect(response).to render_template('show')
|
||||
expect(flash[:alert]).to be_present
|
||||
end
|
||||
end
|
||||
|
||||
context 'Mauvais format(s)' do
|
||||
it 'mail_contact n\'est un format d\'email' do
|
||||
post :create, dossier_id: dossier_id, nom_projet: nom_projet, description: description, montant_projet: montant_projet, montant_aide_demande: montant_aide_demande, date_previsionnelle: date_previsionnelle, mail_contact: 'test.com'
|
||||
expect(response).to render_template('show')
|
||||
expect(flash[:alert]).to be_present
|
||||
end
|
||||
end
|
||||
|
||||
context 'Sauvegarde du CERFA PDF' do
|
||||
|
@ -135,7 +119,6 @@ describe DescriptionController, type: :controller do
|
|||
montant_projet: montant_projet,
|
||||
montant_aide_demande: montant_aide_demande,
|
||||
date_previsionnelle: date_previsionnelle,
|
||||
mail_contact: mail_contact,
|
||||
cerfa_pdf: cerfa_pdf
|
||||
dossier.reload
|
||||
end
|
||||
|
@ -153,7 +136,7 @@ describe DescriptionController, type: :controller do
|
|||
|
||||
context 'les anciens CERFA PDF sont écrasées à chaque fois' do
|
||||
it 'il n\'y a qu\'un CERFA PDF par dossier' do
|
||||
post :create, dossier_id: dossier_id, nom_projet: nom_projet, description: description, montant_projet: montant_projet, montant_aide_demande: montant_aide_demande, date_previsionnelle: date_previsionnelle, mail_contact: mail_contact, cerfa_pdf: cerfa_pdf
|
||||
post :create, dossier_id: dossier_id, nom_projet: nom_projet, description: description, montant_projet: montant_projet, montant_aide_demande: montant_aide_demande, date_previsionnelle: date_previsionnelle, cerfa_pdf: cerfa_pdf
|
||||
cerfa = PieceJustificative.where(type_de_piece_justificative_id: '0', dossier_id: dossier_id)
|
||||
expect(cerfa.many?).to eq(false)
|
||||
end
|
||||
|
@ -173,7 +156,6 @@ describe DescriptionController, type: :controller do
|
|||
montant_projet: montant_projet,
|
||||
montant_aide_demande: montant_aide_demande,
|
||||
date_previsionnelle: date_previsionnelle,
|
||||
mail_contact: mail_contact,
|
||||
'piece_justificative_'+all_pj_type[0].to_s => piece_justificative_0,
|
||||
'piece_justificative_'+all_pj_type[1].to_s => piece_justificative_1}
|
||||
dossier.reload
|
||||
|
|
|
@ -7,10 +7,10 @@ FactoryGirl.define do
|
|||
trait :with_two_type_de_piece_justificative do
|
||||
after(:build) do |procedure, _evaluator|
|
||||
rib = create(:type_de_piece_justificative, :rib)
|
||||
contrat = create(:type_de_piece_justificative, :contrat)
|
||||
msa = create(:type_de_piece_justificative, :msa)
|
||||
|
||||
procedure.types_de_piece_justificative << rib
|
||||
procedure.types_de_piece_justificative << contrat
|
||||
procedure.types_de_piece_justificative << msa
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,10 +2,14 @@ FactoryGirl.define do
|
|||
factory :type_de_piece_justificative do
|
||||
trait :rib do
|
||||
libelle 'RIB'
|
||||
description 'Releve identité bancaire'
|
||||
api_entreprise false
|
||||
end
|
||||
|
||||
trait :contrat do
|
||||
libelle 'Contrat'
|
||||
trait :msa do
|
||||
libelle 'Attestation MSA'
|
||||
description 'recuperation automatique'
|
||||
api_entreprise true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -33,6 +33,7 @@ feature 'Admin/Dossier#Show Page' do
|
|||
end
|
||||
end
|
||||
|
||||
#TODO réactiver
|
||||
# context 'la liste des pièces justificatives est présente' do
|
||||
# context 'Attestation MSA' do
|
||||
# let(:id_piece_justificative) { 93 }
|
||||
|
|
|
@ -45,14 +45,6 @@ feature 'Description#Show Page' do
|
|||
expect(page).to have_selector('input[type=text][id=date_previsionnelle][data-provide=datepicker]')
|
||||
end
|
||||
|
||||
scenario 'Mail de contact' do
|
||||
expect(page).to have_selector('input[id=mail_contact][name=mail_contact]')
|
||||
end
|
||||
|
||||
scenario 'Mail de contact est de type mail' do
|
||||
expect(page).to have_selector('input[type=email][id=mail_contact]')
|
||||
end
|
||||
|
||||
scenario 'Charger votre CERFA (PDF)' do
|
||||
expect(page).to have_selector('input[type=file][name=cerfa_pdf][id=cerfa_pdf]')
|
||||
end
|
||||
|
@ -97,8 +89,7 @@ feature 'Description#Show Page' do
|
|||
description: 'Description de test',
|
||||
montant_projet: 12_000,
|
||||
montant_aide_demande: 3000,
|
||||
date_previsionnelle: '20/01/2016',
|
||||
mail_contact: 'test@test.com')
|
||||
date_previsionnelle: '20/01/2016')
|
||||
end
|
||||
|
||||
scenario 'Nom du projet' do
|
||||
|
@ -120,31 +111,21 @@ feature 'Description#Show Page' do
|
|||
scenario 'Date prévisionnelle du projet' do
|
||||
expect(page).to have_selector("input[id=date_previsionnelle][value='#{dossier.date_previsionnelle}']")
|
||||
end
|
||||
|
||||
scenario 'Mail de contact' do
|
||||
expect(page).to have_selector("input[id=mail_contact][value='#{dossier.mail_contact}']")
|
||||
end
|
||||
end
|
||||
|
||||
# context 'Pièces justificatives' do
|
||||
# context 'la liste des pièces justificatives a envoyé est affichée' do
|
||||
# it 'Contrat' do
|
||||
# expect(page).to have_selector('input[type=file][name=piece_justificative_764][id=piece_justificative_764]')
|
||||
# end
|
||||
#
|
||||
# it 'RIB' do
|
||||
# expect(page).to have_selector('input[type=file][name=piece_justificative_849][id=piece_justificative_849]')
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# context 'la liste des pièces récupérées automatiquement est signaliée' do
|
||||
# it 'Attestation MSA' do
|
||||
# expect(page.find_by_id('piece_justificative_93')).to have_content('Nous l\'avons récupéré pour vous.')
|
||||
# end
|
||||
#
|
||||
# it 'KBIS' do
|
||||
# expect(page.find_by_id('piece_justificative_571')).to have_content('Nous l\'avons récupéré pour vous.')
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
context 'Pièces justificatives' do
|
||||
let(:all_type_pj_procedure_id) { dossier.procedure.type_de_piece_justificative_ids }
|
||||
|
||||
context 'la liste des pièces justificatives a envoyé est affichée' do
|
||||
it 'RIB' do
|
||||
expect(page).to have_selector("input[type=file][name=piece_justificative_#{all_type_pj_procedure_id[0]}][id=piece_justificative_#{all_type_pj_procedure_id[0]}]")
|
||||
end
|
||||
end
|
||||
|
||||
context 'la liste des pièces récupérées automatiquement est signaliée' do
|
||||
it 'Attestation MSA' do
|
||||
expect(page.find_by_id("piece_justificative_#{all_type_pj_procedure_id[1]}")).to have_content('Nous l\'avons récupéré pour vous.')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,7 +14,6 @@ feature 'user is on description page' do
|
|||
find_by_id('montant_projet').set 10_000
|
||||
find_by_id('montant_aide_demande').set 100
|
||||
find_by_id('date_previsionnelle').set '10/10/2010'
|
||||
find_by_id('mail_contact').set 'plop@plop.com'
|
||||
end
|
||||
context 'before submit' do
|
||||
it 'dossier cerfa is empty' do
|
||||
|
|
|
@ -24,16 +24,6 @@ feature 'Recapitulatif#Show Page' do
|
|||
end
|
||||
|
||||
context 'les liens de modifications' do
|
||||
context 'lien carte' do
|
||||
scenario 'le lien vers carte est présent' do
|
||||
expect(page).to have_selector('a[id=modif_carte]')
|
||||
end
|
||||
|
||||
scenario 'le lien vers carte est correct' do
|
||||
expect(page).to have_selector("a[id=modif_carte][href='/dossiers/#{dossier_id}/carte?back_url=recapitulatif']")
|
||||
end
|
||||
end
|
||||
|
||||
context 'lien description' do
|
||||
scenario 'le lien vers description est présent' do
|
||||
expect(page).to have_css('#modif_description')
|
||||
|
|
|
@ -6,13 +6,10 @@ describe Dossier do
|
|||
it { is_expected.to have_db_column(:autorisation_donnees) }
|
||||
it { is_expected.to have_db_column(:position_lat) }
|
||||
it { is_expected.to have_db_column(:position_lon) }
|
||||
it { is_expected.to have_db_column(:ref_dossier) }
|
||||
it { is_expected.to have_db_column(:nom_projet) }
|
||||
it { is_expected.to have_db_column(:montant_projet) }
|
||||
it { is_expected.to have_db_column(:montant_aide_demande) }
|
||||
it { is_expected.to have_db_column(:date_previsionnelle).of_type(:date) }
|
||||
it { is_expected.to have_db_column(:lien_plus_infos) }
|
||||
it { is_expected.to have_db_column(:mail_contact) }
|
||||
it { is_expected.to have_db_column(:dossier_termine) }
|
||||
it { is_expected.to have_db_column(:created_at) }
|
||||
it { is_expected.to have_db_column(:updated_at) }
|
||||
|
@ -34,10 +31,6 @@ describe Dossier do
|
|||
end
|
||||
|
||||
describe 'validation' do
|
||||
context 'mail_contact' do
|
||||
it { is_expected.to allow_value('tanguy@plop.com').for(:mail_contact) }
|
||||
it { is_expected.not_to allow_value('tanguyplop.com').for(:mail_contact) }
|
||||
end
|
||||
context 'nom_projet' do
|
||||
it { is_expected.to allow_value(nil).for(:nom_projet) }
|
||||
it { is_expected.not_to allow_value('').for(:nom_projet) }
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe TypeDePieceJustificative do
|
||||
let!(:procedure) { create(:procedure) }
|
||||
|
||||
describe 'database columns' do
|
||||
it { is_expected.to have_db_column(:libelle) }
|
||||
it { is_expected.to have_db_column(:description) }
|
||||
|
@ -13,4 +15,18 @@ describe TypeDePieceJustificative do
|
|||
it { is_expected.to have_many(:pieces_justificatives) }
|
||||
it { is_expected.to belong_to(:procedure) }
|
||||
end
|
||||
|
||||
describe 'validation' do
|
||||
context 'libelle' do
|
||||
it { is_expected.not_to allow_value(nil).for(:libelle) }
|
||||
it { is_expected.not_to allow_value('').for(:libelle) }
|
||||
it { is_expected.to allow_value('RIB').for(:libelle) }
|
||||
end
|
||||
|
||||
context 'description' do
|
||||
it { is_expected.not_to allow_value(nil).for(:description) }
|
||||
it { is_expected.not_to allow_value('').for(:description) }
|
||||
it { is_expected.to allow_value('Releve identité bancaire').for(:description) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue