From 542cdbaefd8762614081a15b3f75a7f4a4b4c179 Mon Sep 17 00:00:00 2001 From: Xavier J Date: Tue, 22 Sep 2015 13:11:56 +0200 Subject: [PATCH 1/5] =?UTF-8?q?validation=20des=20pi=C3=A8ces=20justificat?= =?UTF-8?q?ive?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/type_de_piece_justificative.rb | 3 +++ ...se_at_false_to_type_de_piece_justificative.rb | 5 +++++ db/schema.rb | 8 ++++---- spec/factories/type_de_piece_justificative.rb | 8 ++++++-- spec/models/type_de_piece_justificative_spec.rb | 16 ++++++++++++++++ 5 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 db/migrate/20150922110719_default_api_entreprise_at_false_to_type_de_piece_justificative.rb diff --git a/app/models/type_de_piece_justificative.rb b/app/models/type_de_piece_justificative.rb index 67126b104..2b5cd7faa 100644 --- a/app/models/type_de_piece_justificative.rb +++ b/app/models/type_de_piece_justificative.rb @@ -1,4 +1,7 @@ class TypeDePieceJustificative < ActiveRecord::Base has_many :pieces_justificatives belongs_to :procedure + + validates :libelle, presence: true, allow_blank: false, allow_nil: false + validates :description, presence: true, allow_blank: false, allow_nil: false end diff --git a/db/migrate/20150922110719_default_api_entreprise_at_false_to_type_de_piece_justificative.rb b/db/migrate/20150922110719_default_api_entreprise_at_false_to_type_de_piece_justificative.rb new file mode 100644 index 000000000..8fca922d2 --- /dev/null +++ b/db/migrate/20150922110719_default_api_entreprise_at_false_to_type_de_piece_justificative.rb @@ -0,0 +1,5 @@ +class DefaultAPIEntrepriseAtFalseToTypeDePieceJustificative < ActiveRecord::Migration + def change + change_column :types_de_piece_justificative, :api_entreprise, :boolean, :default => false + end +end diff --git a/db/schema.rb b/db/schema.rb index 2f1cdcf05..d65a06484 100644 --- a/db/schema.rb +++ b/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: 20150922085811) do +ActiveRecord::Schema.define(version: 20150922110719) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -126,9 +126,9 @@ ActiveRecord::Schema.define(version: 20150922085811) do create_table "types_de_piece_justificative", force: :cascade do |t| t.string "libelle" t.string "description" - t.boolean "api_entreprise" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.boolean "api_entreprise", default: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.integer "procedure_id" end diff --git a/spec/factories/type_de_piece_justificative.rb b/spec/factories/type_de_piece_justificative.rb index bec3844fa..79f14c0d8 100644 --- a/spec/factories/type_de_piece_justificative.rb +++ b/spec/factories/type_de_piece_justificative.rb @@ -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 diff --git a/spec/models/type_de_piece_justificative_spec.rb b/spec/models/type_de_piece_justificative_spec.rb index 1bcfbb9f6..307af538d 100644 --- a/spec/models/type_de_piece_justificative_spec.rb +++ b/spec/models/type_de_piece_justificative_spec.rb @@ -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 From 1bdc737838172de4b7be1cc0f94ac446b21b978c Mon Sep 17 00:00:00 2001 From: Xavier J Date: Tue, 22 Sep 2015 13:15:58 +0200 Subject: [PATCH 2/5] =?UTF-8?q?Correction=20des=20derniers=20tests=20suite?= =?UTF-8?q?s=20au=20changement=20de=20sch=C3=A9ma=20de=20la=20BDD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/factories/procedure.rb | 4 +-- .../admin/dossier_page/show_page_spec.rb | 1 + .../description_page/show_page_spec.rb | 36 ++++++++----------- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/spec/factories/procedure.rb b/spec/factories/procedure.rb index 7a60ee69d..3b34c775a 100644 --- a/spec/factories/procedure.rb +++ b/spec/factories/procedure.rb @@ -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 diff --git a/spec/features/admin/dossier_page/show_page_spec.rb b/spec/features/admin/dossier_page/show_page_spec.rb index 8fe2a3088..577a5f17c 100644 --- a/spec/features/admin/dossier_page/show_page_spec.rb +++ b/spec/features/admin/dossier_page/show_page_spec.rb @@ -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 } diff --git a/spec/features/description_page/show_page_spec.rb b/spec/features/description_page/show_page_spec.rb index d6ddd2b84..b72402987 100644 --- a/spec/features/description_page/show_page_spec.rb +++ b/spec/features/description_page/show_page_spec.rb @@ -126,25 +126,19 @@ feature 'Description#Show Page' do 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 From 810395c428ee5a2e8c75b7379b72e71cfd3dd4a2 Mon Sep 17 00:00:00 2001 From: Xavier J Date: Tue, 22 Sep 2015 13:58:32 +0200 Subject: [PATCH 3/5] Rename and remove attribut into Dossier --- app/controllers/carte_controller.rb | 4 +-- app/controllers/description_controller.rb | 2 +- app/controllers/recapitulatif_controller.rb | 3 ++- app/models/dossier.rb | 1 - app/views/admin/dossier/show.html.haml | 2 +- .../carte/_carte_sources_JS_backend.html.haml | 2 +- app/views/description/show.html.haml | 4 --- app/views/dossiers/_infos_dossier.html.haml | 7 ----- config/locales/models/dossier/fr.yml | 1 - ...50922113504_change_attributs_to_dossier.rb | 8 ++++++ db/schema.rb | 10 +++---- .../description_controller_spec.rb | 26 +++---------------- .../description_page/show_page_spec.rb | 15 +---------- .../upload_piece_justificative_spec.rb | 1 - spec/models/dossier_spec.rb | 7 ----- 15 files changed, 24 insertions(+), 69 deletions(-) create mode 100644 db/migrate/20150922113504_change_attributs_to_dossier.rb diff --git a/app/controllers/carte_controller.rb b/app/controllers/carte_controller.rb index 97a9c1788..d36f24d14 100644 --- a/app/controllers/carte_controller.rb +++ b/app/controllers/carte_controller.rb @@ -9,8 +9,8 @@ class CarteController < ApplicationController def save_ref_api_carto dossier = current_dossier - if dossier.ref_dossier.blank? - dossier.update_attributes(ref_dossier: params[:ref_dossier]) + if dossier.ref_dossier_carto.blank? + dossier.update_attributes(ref_dossier_carto: params[:ref_dossier]) redirect_to url_for(controller: :description, action: :show, dossier_id: params[:dossier_id]) else commentaire_params = { diff --git a/app/controllers/description_controller.rb b/app/controllers/description_controller.rb index e407fe332..7835f1e00 100644 --- a/app/controllers/description_controller.rb +++ b/app/controllers/description_controller.rb @@ -52,6 +52,6 @@ class DescriptionController < ApplicationController private 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 diff --git a/app/controllers/recapitulatif_controller.rb b/app/controllers/recapitulatif_controller.rb index 4d1e02e56..194cd0f0e 100644 --- a/app/controllers/recapitulatif_controller.rb +++ b/app/controllers/recapitulatif_controller.rb @@ -8,7 +8,8 @@ class RecapitulatifController < ApplicationController @commentaires = @commentaires.all.decorate - @commentaire_email = @dossier.mail_contact + #TODO load user email + @commentaire_email = 'user@email' rescue ActiveRecord::RecordNotFound redirect_to url_for(controller: :start, action: :error_dossier) end diff --git a/app/models/dossier.rb b/app/models/dossier.rb index dd1455aa4..a4846cbda 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -14,7 +14,6 @@ class Dossier < ActiveRecord::Base 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 :description, presence: true, allow_blank: false, allow_nil: true validates :montant_projet, presence: true, allow_blank: false, allow_nil: true diff --git a/app/views/admin/dossier/show.html.haml b/app/views/admin/dossier/show.html.haml index 1886e904b..3f91156f4 100644 --- a/app/views/admin/dossier/show.html.haml +++ b/app/views/admin/dossier/show.html.haml @@ -3,7 +3,7 @@ %script{type: 'text/javascript'} ="url_carte = '#{@dossier.id}/'" - ="ref_dossier = '#{@dossier.ref_dossier}'" + ="ref_dossier = '#{@dossier.ref_dossier_carto}'" = render partial: '/dossiers/infos_entreprise' %br diff --git a/app/views/carte/_carte_sources_JS_backend.html.haml b/app/views/carte/_carte_sources_JS_backend.html.haml index e9d961be2..cc0f8ce38 100644 --- a/app/views/carte/_carte_sources_JS_backend.html.haml +++ b/app/views/carte/_carte_sources_JS_backend.html.haml @@ -1,6 +1,6 @@ %script{type: 'text/javascript'} ="var dossier_id =#{@dossier.id}" - ="var ref_dossier=#{@dossier.ref_dossier}" + ="var ref_dossier=#{@dossier.ref_dossier_carto}" %div#sources_JS_api_carto_backend diff --git a/app/views/description/show.html.haml b/app/views/description/show.html.haml index 1868d421e..c109d31ef 100644 --- a/app/views/description/show.html.haml +++ b/app/views/description/show.html.haml @@ -33,10 +33,6 @@ %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' - .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 %h3 Documents administratifs diff --git a/app/views/dossiers/_infos_dossier.html.haml b/app/views/dossiers/_infos_dossier.html.haml index c7ca90c76..c16d6f573 100644 --- a/app/views/dossiers/_infos_dossier.html.haml +++ b/app/views/dossiers/_infos_dossier.html.haml @@ -24,13 +24,6 @@ %p = @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') .col-lg-6.col-md-6 %br diff --git a/config/locales/models/dossier/fr.yml b/config/locales/models/dossier/fr.yml index 383373dde..56faa910b 100644 --- a/config/locales/models/dossier/fr.yml +++ b/config/locales/models/dossier/fr.yml @@ -4,7 +4,6 @@ fr: dossier: 'Dossier' attributes: dossier: - mail_contact: 'Le mail de contact' nom_projet: 'Le nom du projet' description: 'La description' montant_projet: 'Le montant du projet' diff --git a/db/migrate/20150922113504_change_attributs_to_dossier.rb b/db/migrate/20150922113504_change_attributs_to_dossier.rb new file mode 100644 index 000000000..f0db034e6 --- /dev/null +++ b/db/migrate/20150922113504_change_attributs_to_dossier.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 0433c7a4f..27b66f15f 100644 --- a/db/schema.rb +++ b/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: 20150922110719) do +ActiveRecord::Schema.define(version: 20150922113504) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -38,17 +38,15 @@ ActiveRecord::Schema.define(version: 20150922110719) do t.boolean "autorisation_donnees" t.string "position_lat" t.string "position_lon" - t.string "ref_dossier" + t.string "ref_dossier_carto" t.string "nom_projet" t.string "montant_projet" t.string "montant_aide_demande" - t.string "lien_plus_infos" - t.string "mail_contact" t.boolean "dossier_termine" t.integer "procedure_id" t.date "date_previsionnelle" - t.datetime "created_at", default: '2015-09-22 09:25:29' - t.datetime "updated_at", default: '2015-09-22 09:25:29' + t.datetime "created_at" + t.datetime "updated_at" end add_index "dossiers", ["procedure_id"], name: "index_dossiers_on_procedure_id", using: :btree diff --git a/spec/controllers/description_controller_spec.rb b/spec/controllers/description_controller_spec.rb index ba472659f..894378bd9 100644 --- a/spec/controllers/description_controller_spec.rb +++ b/spec/controllers/description_controller_spec.rb @@ -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 diff --git a/spec/features/description_page/show_page_spec.rb b/spec/features/description_page/show_page_spec.rb index b72402987..226db6a9a 100644 --- a/spec/features/description_page/show_page_spec.rb +++ b/spec/features/description_page/show_page_spec.rb @@ -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,10 +111,6 @@ 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 diff --git a/spec/features/description_page/upload_piece_justificative_spec.rb b/spec/features/description_page/upload_piece_justificative_spec.rb index 3612a9b9f..92ad922cc 100644 --- a/spec/features/description_page/upload_piece_justificative_spec.rb +++ b/spec/features/description_page/upload_piece_justificative_spec.rb @@ -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 diff --git a/spec/models/dossier_spec.rb b/spec/models/dossier_spec.rb index 28ff0e1fd..e3928da5d 100644 --- a/spec/models/dossier_spec.rb +++ b/spec/models/dossier_spec.rb @@ -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) } From a485848908301439b33d0e64ed883327b4fc9c90 Mon Sep 17 00:00:00 2001 From: Xavier J Date: Tue, 22 Sep 2015 14:08:41 +0200 Subject: [PATCH 4/5] change default page 404 for not found procedure --- app/controllers/start_controller.rb | 2 +- public/404_procedure_not_found.html | 66 +++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 public/404_procedure_not_found.html diff --git a/app/controllers/start_controller.rb b/app/controllers/start_controller.rb index bd7ede7cc..c645117dd 100644 --- a/app/controllers/start_controller.rb +++ b/app/controllers/start_controller.rb @@ -11,7 +11,7 @@ class StartController < ApplicationController end 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 def error_siret diff --git a/public/404_procedure_not_found.html b/public/404_procedure_not_found.html new file mode 100644 index 000000000..4bbd3e742 --- /dev/null +++ b/public/404_procedure_not_found.html @@ -0,0 +1,66 @@ + + + + The page you were looking for doesn't exist (404) + + + + + + +
+
+

Cette procédure n'existe pas.

+

Merci de vérifier le lien que vous avez suivi et/ou de contacter votre administrateur.

+
+

Si vous êtes l'administrateur de l'application, merci de regarder les logs.

+
+ + From 7443d2feefe8202ee73d9adf740338ba6b83c158 Mon Sep 17 00:00:00 2001 From: Xavier J Date: Tue, 22 Sep 2015 14:09:32 +0200 Subject: [PATCH 5/5] delete "Modification localisation" in page "recapitulatif" --- app/views/dossiers/_infos_dossier.html.haml | 2 -- spec/features/recapitulatif_page/show_page_spec.rb | 10 ---------- 2 files changed, 12 deletions(-) diff --git a/app/views/dossiers/_infos_dossier.html.haml b/app/views/dossiers/_infos_dossier.html.haml index c16d6f573..d641ce851 100644 --- a/app/views/dossiers/_infos_dossier.html.haml +++ b/app/views/dossiers/_infos_dossier.html.haml @@ -28,8 +28,6 @@ .col-lg-6.col-md-6 %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 .col-md-6 diff --git a/spec/features/recapitulatif_page/show_page_spec.rb b/spec/features/recapitulatif_page/show_page_spec.rb index 2115f290a..0cdbbd0d8 100644 --- a/spec/features/recapitulatif_page/show_page_spec.rb +++ b/spec/features/recapitulatif_page/show_page_spec.rb @@ -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_selector('a[id=modif_description]')