affiche Madame ou Monsieur

mais continue à enregistrer en base Mme ou M.
This commit is contained in:
Christophe Robillard 2020-12-08 21:30:54 +01:00
parent 2066e3db87
commit 23ae528c6b
6 changed files with 11 additions and 8 deletions

View file

@ -19,8 +19,8 @@ class Individual < ApplicationRecord
validates :nom, presence: true, allow_blank: false, allow_nil: false, on: :update
validates :prenom, presence: true, allow_blank: false, allow_nil: false, on: :update
GENDER_MALE = 'Monsieur'
GENDER_FEMALE = 'Madame'
GENDER_MALE = "M."
GENDER_FEMALE = 'Mme'
def self.from_france_connect(fc_information)
new(

View file

@ -3,8 +3,8 @@
Sélectionnez une des valeurs
%label
= form.radio_button :value, Individual::GENDER_FEMALE
= Individual::GENDER_FEMALE
= t(Individual::GENDER_FEMALE, scope: 'activerecord.attributes.individual.gender_options')
%label
= form.radio_button :value, Individual::GENDER_MALE
= Individual::GENDER_MALE
= t('activerecord.attributes.individual.gender_options')[Individual::GENDER_MALE.to_sym] # GENDER_MALE contains a point letter

View file

@ -14,10 +14,10 @@
.radios
%label
= f.radio_button :gender, Individual::GENDER_FEMALE, required: true
= Individual::GENDER_FEMALE
= t(Individual::GENDER_FEMALE, scope: 'activerecord.attributes.individual.gender_options')
%label
= f.radio_button :gender, Individual::GENDER_MALE, required: true
= Individual::GENDER_MALE
= t('activerecord.attributes.individual.gender_options')[Individual::GENDER_MALE.to_sym] # GENDER_MALE contains a point letter
.flex
.inline-champ

View file

@ -6,3 +6,6 @@ fr:
nom: Nom
prenom: Prénom
birthdate: Date de naissance
gender_options:
"Mme": "Madame"
"M." : "Monsieur"

View file

@ -1,6 +1,6 @@
FactoryBot.define do
factory :individual do
gender { 'Monsieur' }
gender { 'M.' }
nom { 'Julien' }
prenom { 'Xavier' }
birthdate { Date.new(1991, 11, 01) }

View file

@ -51,7 +51,7 @@ feature 'The user' do
expect(champ_value_for('datetime')).to eq('06/01/2030 07:05')
expect(champ_value_for('number')).to eq('42')
expect(champ_value_for('checkbox')).to eq('on')
expect(champ_value_for('civilite')).to eq('Madame')
expect(champ_value_for('civilite')).to eq('Mme')
expect(champ_value_for('email')).to eq('loulou@yopmail.com')
expect(champ_value_for('phone')).to eq('0123456789')
expect(champ_value_for('yes_no')).to eq('false')