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:
Tanguy PATTE 2015-09-22 15:02:04 +02:00
commit d034176fe3
24 changed files with 143 additions and 109 deletions

View file

@ -9,8 +9,8 @@ class CarteController < ApplicationController
def save_ref_api_carto def save_ref_api_carto
dossier = current_dossier dossier = current_dossier
if dossier.ref_dossier.blank? if dossier.ref_dossier_carto.blank?
dossier.update_attributes(ref_dossier: params[:ref_dossier]) dossier.update_attributes(ref_dossier_carto: params[:ref_dossier])
redirect_to url_for(controller: :description, action: :show, dossier_id: params[:dossier_id]) redirect_to url_for(controller: :description, action: :show, dossier_id: params[:dossier_id])
else else
commentaire_params = { commentaire_params = {

View file

@ -52,6 +52,6 @@ class DescriptionController < ApplicationController
private private
def create_params def create_params
params.permit(:nom_projet, :description, :montant_projet, :montant_aide_demande, :date_previsionnelle, :lien_plus_infos, :mail_contact) params.permit(:nom_projet, :description, :montant_projet, :montant_aide_demande, :date_previsionnelle)
end end
end end

View file

@ -8,7 +8,8 @@ class RecapitulatifController < ApplicationController
@commentaires = @commentaires.all.decorate @commentaires = @commentaires.all.decorate
@commentaire_email = @dossier.mail_contact #TODO load user email
@commentaire_email = 'user@email'
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
redirect_to url_for(controller: :start, action: :error_dossier) redirect_to url_for(controller: :start, action: :error_dossier)
end end

View file

@ -11,7 +11,7 @@ class StartController < ApplicationController
end end
def error_procedure def error_procedure
render :file => "#{Rails.root}/public/404.html", :status => 404 render :file => "#{Rails.root}/public/404_procedure_not_found.html", :status => 404
end end
def error_siret def error_siret

View file

@ -14,7 +14,6 @@ class Dossier < ActiveRecord::Base
after_save :build_default_pieces_justificatives, if: Proc.new { procedure_id_changed? } after_save :build_default_pieces_justificatives, if: Proc.new { procedure_id_changed? }
validates :mail_contact, format: { with: /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/ }, unless: 'mail_contact.nil?'
validates :nom_projet, presence: true, allow_blank: false, allow_nil: true validates :nom_projet, presence: true, allow_blank: false, allow_nil: true
validates :description, presence: true, allow_blank: false, allow_nil: true validates :description, presence: true, allow_blank: false, allow_nil: true
validates :montant_projet, presence: true, allow_blank: false, allow_nil: true validates :montant_projet, presence: true, allow_blank: false, allow_nil: true

View file

@ -1,4 +1,7 @@
class TypeDePieceJustificative < ActiveRecord::Base class TypeDePieceJustificative < ActiveRecord::Base
has_many :pieces_justificatives has_many :pieces_justificatives
belongs_to :procedure belongs_to :procedure
validates :libelle, presence: true, allow_blank: false, allow_nil: false
validates :description, presence: true, allow_blank: false, allow_nil: false
end end

View file

@ -4,7 +4,7 @@
%script{type: 'text/javascript'} %script{type: 'text/javascript'}
="url_carte = '#{@dossier.id}/'" ="url_carte = '#{@dossier.id}/'"
="ref_dossier = '#{@dossier.ref_dossier}'" ="ref_dossier = '#{@dossier.ref_dossier_carto}'"
= render partial: '/dossiers/infos_entreprise' = render partial: '/dossiers/infos_entreprise'
%br %br

View file

@ -1,6 +1,6 @@
%script{type: 'text/javascript'} %script{type: 'text/javascript'}
="var dossier_id =#{@dossier.id}" ="var dossier_id =#{@dossier.id}"
="var ref_dossier=#{@dossier.ref_dossier}" ="var ref_dossier=#{@dossier.ref_dossier_carto}"
%div#sources_JS_api_carto_backend %div#sources_JS_api_carto_backend

View file

@ -33,10 +33,6 @@
%h4 Date prévisionnelle du début de votre projet * %h4 Date prévisionnelle du début de votre projet *
= text_field_tag :date_previsionnelle, @dossier.date_previsionnelle, placeholder: 'Date prévisionnelle', class: 'form-control', 'data-provide' => 'datepicker', 'data-date-format' => 'dd/mm/yyyy' = text_field_tag :date_previsionnelle, @dossier.date_previsionnelle, placeholder: 'Date prévisionnelle', class: 'form-control', 'data-provide' => 'datepicker', 'data-date-format' => 'dd/mm/yyyy'
.col-lg-6.col-md-6
%h4 Mail de contact *
= email_field_tag :mail_contact, @dossier.mail_contact, placeholder: 'Mail de contact', class: 'form-control'
%br %br
%h3 Documents administratifs %h3 Documents administratifs

View file

@ -24,21 +24,14 @@
%p %p
= @dossier.date_fr = @dossier.date_fr
.col-lg-6.col-md-6
%br
%h4 Contact
%a{ href: "mailto:#{@dossier.mail_contact}" }
= @dossier.mail_contact
/ -if !request.url.include?('admin') / -if !request.url.include?('admin')
.col-lg-6.col-md-6 .col-lg-6.col-md-6
%br %br
%br %br
%a#modif_carte{href: "/dossiers/#{@dossier.id}/carte?back_url=recapitulatif"} Modifier la localisation
%br
%a#modif_description{href: "/dossiers/#{@dossier.id}/description?back_url=recapitulatif"} Modifier la description %a#modif_description{href: "/dossiers/#{@dossier.id}/description?back_url=recapitulatif"} Modifier la description
.col-md-6 .col-md-6
= pie_chart({"Montant à charge #{(100 - @dossier.montant_aide_demande.to_f/@dossier.montant_projet.to_f*100).round(2)}%" => (@dossier.montant_projet.to_f - @dossier.montant_aide_demande.to_f), "Montant souhaité #{(@dossier.montant_aide_demande.to_f/@dossier.montant_projet.to_f*100).round(2)}%" => @dossier.montant_aide_demande}) = pie_chart({"Montant à charge #{(100 - @dossier.montant_aide_demande.to_f/@dossier.montant_projet.to_f*100).round(2)}%" => (@dossier.montant_projet.to_f - @dossier.montant_aide_demande.to_f), "Montant souhaité #{(@dossier.montant_aide_demande.to_f/@dossier.montant_projet.to_f*100).round(2)}%" => @dossier.montant_aide_demande})

View file

@ -4,7 +4,6 @@ fr:
dossier: 'Dossier' dossier: 'Dossier'
attributes: attributes:
dossier: dossier:
mail_contact: 'Le mail de contact'
nom_projet: 'Le nom du projet' nom_projet: 'Le nom du projet'
description: 'La description' description: 'La description'
montant_projet: 'Le montant du projet' montant_projet: 'Le montant du projet'

View file

@ -0,0 +1,5 @@
class DefaultAPIEntrepriseAtFalseToTypeDePieceJustificative < ActiveRecord::Migration
def change
change_column :types_de_piece_justificative, :api_entreprise, :boolean, :default => false
end
end

View file

@ -0,0 +1,8 @@
class ChangeAttributsToDossier < ActiveRecord::Migration
def change
remove_column :dossiers, :lien_plus_infos
remove_column :dossiers, :mail_contact
rename_column :dossiers, :ref_dossier, :ref_dossier_carto
end
end

View file

@ -11,7 +11,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: 20150922085811) do ActiveRecord::Schema.define(version: 20150922113504) 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"
@ -38,17 +38,15 @@ ActiveRecord::Schema.define(version: 20150922085811) do
t.boolean "autorisation_donnees" t.boolean "autorisation_donnees"
t.string "position_lat" t.string "position_lat"
t.string "position_lon" t.string "position_lon"
t.string "ref_dossier" t.string "ref_dossier_carto"
t.string "nom_projet" t.string "nom_projet"
t.string "montant_projet" t.string "montant_projet"
t.string "montant_aide_demande" t.string "montant_aide_demande"
t.string "lien_plus_infos"
t.string "mail_contact"
t.boolean "dossier_termine" t.boolean "dossier_termine"
t.integer "procedure_id" t.integer "procedure_id"
t.date "date_previsionnelle" t.date "date_previsionnelle"
t.datetime "created_at", default: '2015-09-22 09:25:29' t.datetime "created_at"
t.datetime "updated_at", default: '2015-09-22 09:25:29' t.datetime "updated_at"
end end
add_index "dossiers", ["procedure_id"], name: "index_dossiers_on_procedure_id", using: :btree add_index "dossiers", ["procedure_id"], name: "index_dossiers_on_procedure_id", using: :btree
@ -126,9 +124,9 @@ ActiveRecord::Schema.define(version: 20150922085811) do
create_table "types_de_piece_justificative", force: :cascade do |t| create_table "types_de_piece_justificative", force: :cascade do |t|
t.string "libelle" t.string "libelle"
t.string "description" t.string "description"
t.boolean "api_entreprise" t.boolean "api_entreprise", default: false
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.integer "procedure_id" t.integer "procedure_id"
end end

View file

@ -0,0 +1,66 @@
<!DOCTYPE html>
<html>
<head>
<title>The page you were looking for doesn't exist (404)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
body {
background-color: #EFEFEF;
color: #2E2F30;
text-align: center;
font-family: arial, sans-serif;
margin: 0;
}
div.dialog {
width: 95%;
max-width: 33em;
margin: 4em auto 0;
}
div.dialog > div {
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #BBB;
border-top: #B00100 solid 4px;
border-top-left-radius: 9px;
border-top-right-radius: 9px;
background-color: white;
padding: 7px 12% 0;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
h3 {
color: #730E15;
font-weight: bold;
}
div.dialog > p {
margin: 0 0 1em;
padding: 1em;
background-color: #F7F7F7;
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #999;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-top-color: #DADADA;
color: #666;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
</style>
</head>
<body>
<!-- This file lives in public/404.html -->
<div class="dialog">
<div>
<h3>Cette procédure n'existe pas.</h3>
<p>Merci de vérifier le lien que vous avez suivi et/ou de contacter votre administrateur.</p>
</div>
<p>Si vous êtes l'administrateur de l'application, merci de regarder les logs.</p>
</div>
</body>
</html>

View file

@ -24,7 +24,6 @@ describe DescriptionController, type: :controller do
let(:montant_projet) { 12_000 } let(:montant_projet) { 12_000 }
let(:montant_aide_demande) { 3000 } let(:montant_aide_demande) { 3000 }
let(:date_previsionnelle) { '20/01/2016' } let(:date_previsionnelle) { '20/01/2016' }
let(:mail_contact) { 'test@test.com' }
let(:name_piece_justificative) { 'dossierPDF.pdf' } let(:name_piece_justificative) { 'dossierPDF.pdf' }
let(:name_piece_justificative_0) { 'piece_justificative_0.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 context 'Tous les attributs sont bons' do
# TODO separer en deux tests : check donnees et check redirect # TODO separer en deux tests : check donnees et check redirect
it 'Premier enregistrement des données' do 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") expect(response).to redirect_to("/dossiers/#{dossier_id}/recapitulatif")
end end
# TODO changer les valeurs des champs et check in bdd # TODO changer les valeurs des champs et check in bdd
context 'En train de modifier les données de description du projet' do context 'En train de modifier les données de description du projet' do
before 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 end
context 'Enregistrement d\'un commentaire informant la modification' do context 'Enregistrement d\'un commentaire informant la modification' do
@ -77,8 +76,7 @@ describe DescriptionController, type: :controller do
description: description, description: description,
montant_projet: montant_projet, montant_projet: montant_projet,
montant_aide_demande: montant_aide_demande, montant_aide_demande: montant_aide_demande,
date_previsionnelle: date_previsionnelle, date_previsionnelle: date_previsionnelle
mail_contact: mail_contact
} }
before { subject } before { subject }
@ -111,20 +109,6 @@ describe DescriptionController, type: :controller do
it { is_expected.to render_template(:show) } it { is_expected.to render_template(:show) }
it { expect(flash[:alert]).to be_present } it { expect(flash[:alert]).to be_present }
end 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 end
context 'Sauvegarde du CERFA PDF' do context 'Sauvegarde du CERFA PDF' do
@ -135,7 +119,6 @@ describe DescriptionController, type: :controller do
montant_projet: montant_projet, montant_projet: montant_projet,
montant_aide_demande: montant_aide_demande, montant_aide_demande: montant_aide_demande,
date_previsionnelle: date_previsionnelle, date_previsionnelle: date_previsionnelle,
mail_contact: mail_contact,
cerfa_pdf: cerfa_pdf cerfa_pdf: cerfa_pdf
dossier.reload dossier.reload
end end
@ -153,7 +136,7 @@ describe DescriptionController, type: :controller do
context 'les anciens CERFA PDF sont écrasées à chaque fois' do context 'les anciens CERFA PDF sont écrasées à chaque fois' do
it 'il n\'y a qu\'un CERFA PDF par dossier' 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) cerfa = PieceJustificative.where(type_de_piece_justificative_id: '0', dossier_id: dossier_id)
expect(cerfa.many?).to eq(false) expect(cerfa.many?).to eq(false)
end end
@ -173,7 +156,6 @@ describe DescriptionController, type: :controller do
montant_projet: montant_projet, montant_projet: montant_projet,
montant_aide_demande: montant_aide_demande, montant_aide_demande: montant_aide_demande,
date_previsionnelle: date_previsionnelle, date_previsionnelle: date_previsionnelle,
mail_contact: mail_contact,
'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

View file

@ -7,10 +7,10 @@ FactoryGirl.define do
trait :with_two_type_de_piece_justificative do trait :with_two_type_de_piece_justificative do
after(:build) do |procedure, _evaluator| after(:build) do |procedure, _evaluator|
rib = create(:type_de_piece_justificative, :rib) 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 << rib
procedure.types_de_piece_justificative << contrat procedure.types_de_piece_justificative << msa
end end
end end
end end

View file

@ -2,10 +2,14 @@ FactoryGirl.define do
factory :type_de_piece_justificative do factory :type_de_piece_justificative do
trait :rib do trait :rib do
libelle 'RIB' libelle 'RIB'
description 'Releve identité bancaire'
api_entreprise false
end end
trait :contrat do trait :msa do
libelle 'Contrat' libelle 'Attestation MSA'
description 'recuperation automatique'
api_entreprise true
end end
end end
end end

View file

@ -33,6 +33,7 @@ feature 'Admin/Dossier#Show Page' do
end end
end end
#TODO réactiver
# context 'la liste des pièces justificatives est présente' do # context 'la liste des pièces justificatives est présente' do
# context 'Attestation MSA' do # context 'Attestation MSA' do
# let(:id_piece_justificative) { 93 } # let(:id_piece_justificative) { 93 }

View file

@ -45,14 +45,6 @@ feature 'Description#Show Page' do
expect(page).to have_selector('input[type=text][id=date_previsionnelle][data-provide=datepicker]') expect(page).to have_selector('input[type=text][id=date_previsionnelle][data-provide=datepicker]')
end 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 scenario 'Charger votre CERFA (PDF)' do
expect(page).to have_selector('input[type=file][name=cerfa_pdf][id=cerfa_pdf]') expect(page).to have_selector('input[type=file][name=cerfa_pdf][id=cerfa_pdf]')
end end
@ -97,8 +89,7 @@ feature 'Description#Show Page' do
description: 'Description de test', description: 'Description de test',
montant_projet: 12_000, montant_projet: 12_000,
montant_aide_demande: 3000, montant_aide_demande: 3000,
date_previsionnelle: '20/01/2016', date_previsionnelle: '20/01/2016')
mail_contact: 'test@test.com')
end end
scenario 'Nom du projet' do scenario 'Nom du projet' do
@ -120,31 +111,21 @@ feature 'Description#Show Page' do
scenario 'Date prévisionnelle du projet' do scenario 'Date prévisionnelle du projet' do
expect(page).to have_selector("input[id=date_previsionnelle][value='#{dossier.date_previsionnelle}']") expect(page).to have_selector("input[id=date_previsionnelle][value='#{dossier.date_previsionnelle}']")
end end
scenario 'Mail de contact' do
expect(page).to have_selector("input[id=mail_contact][value='#{dossier.mail_contact}']")
end
end end
# context 'Pièces justificatives' do context 'Pièces justificatives' do
# context 'la liste des pièces justificatives a envoyé est affichée' do let(:all_type_pj_procedure_id) { dossier.procedure.type_de_piece_justificative_ids }
# it 'Contrat' do
# expect(page).to have_selector('input[type=file][name=piece_justificative_764][id=piece_justificative_764]') context 'la liste des pièces justificatives a envoyé est affichée' do
# end 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]}]")
# it 'RIB' do end
# expect(page).to have_selector('input[type=file][name=piece_justificative_849][id=piece_justificative_849]') end
# end
# end context 'la liste des pièces récupérées automatiquement est signaliée' do
# it 'Attestation MSA' do
# context 'la liste des pièces récupérées automatiquement est signaliée' 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.')
# it 'Attestation MSA' do end
# expect(page.find_by_id('piece_justificative_93')).to have_content('Nous l\'avons récupéré pour vous.') end
# end 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
end end

View file

@ -14,7 +14,6 @@ feature 'user is on description page' do
find_by_id('montant_projet').set 10_000 find_by_id('montant_projet').set 10_000
find_by_id('montant_aide_demande').set 100 find_by_id('montant_aide_demande').set 100
find_by_id('date_previsionnelle').set '10/10/2010' find_by_id('date_previsionnelle').set '10/10/2010'
find_by_id('mail_contact').set 'plop@plop.com'
end end
context 'before submit' do context 'before submit' do
it 'dossier cerfa is empty' do it 'dossier cerfa is empty' do

View file

@ -24,16 +24,6 @@ feature 'Recapitulatif#Show Page' do
end end
context 'les liens de modifications' do 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 context 'lien description' do
scenario 'le lien vers description est présent' do scenario 'le lien vers description est présent' do
expect(page).to have_css('#modif_description') expect(page).to have_css('#modif_description')

View file

@ -6,13 +6,10 @@ describe Dossier do
it { is_expected.to have_db_column(:autorisation_donnees) } 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_lat) }
it { is_expected.to have_db_column(:position_lon) } 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(:nom_projet) }
it { is_expected.to have_db_column(:montant_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(:montant_aide_demande) }
it { is_expected.to have_db_column(:date_previsionnelle).of_type(:date) } 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(:dossier_termine) }
it { is_expected.to have_db_column(:created_at) } it { is_expected.to have_db_column(:created_at) }
it { is_expected.to have_db_column(:updated_at) } it { is_expected.to have_db_column(:updated_at) }
@ -34,10 +31,6 @@ describe Dossier do
end end
describe 'validation' do 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 context 'nom_projet' do
it { is_expected.to allow_value(nil).for(:nom_projet) } it { is_expected.to allow_value(nil).for(:nom_projet) }
it { is_expected.not_to allow_value('').for(:nom_projet) } it { is_expected.not_to allow_value('').for(:nom_projet) }

View file

@ -1,6 +1,8 @@
require 'spec_helper' require 'spec_helper'
describe TypeDePieceJustificative do describe TypeDePieceJustificative do
let!(:procedure) { create(:procedure) }
describe 'database columns' do describe 'database columns' do
it { is_expected.to have_db_column(:libelle) } it { is_expected.to have_db_column(:libelle) }
it { is_expected.to have_db_column(:description) } 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 have_many(:pieces_justificatives) }
it { is_expected.to belong_to(:procedure) } it { is_expected.to belong_to(:procedure) }
end 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 end