replace filter+first with find
This commit is contained in:
parent
dfd2c1ee79
commit
f3e487bd9e
3 changed files with 8 additions and 16 deletions
|
@ -213,8 +213,7 @@ feature 'The routing', js: true do
|
|||
|
||||
def register_instructeur_and_log_in(email)
|
||||
confirmation_email = emails_sent_to(email)
|
||||
.filter { |m| m.subject == 'Activez votre compte instructeur' }
|
||||
.first
|
||||
.find { |m| m.subject == 'Activez votre compte instructeur' }
|
||||
token_params = confirmation_email.body.match(/token=[^"]+/)
|
||||
|
||||
visit "users/activate?#{token_params}"
|
||||
|
|
|
@ -151,13 +151,11 @@ describe AttestationTemplate, type: :model do
|
|||
context 'and their value in the dossier are not nil' do
|
||||
before do
|
||||
dossier.champs
|
||||
.filter { |champ| champ.libelle == 'libelleA' }
|
||||
.first
|
||||
.find { |champ| champ.libelle == 'libelleA' }
|
||||
.update(value: 'libelle1')
|
||||
|
||||
dossier.champs
|
||||
.filter { |champ| champ.libelle == 'libelleB' }
|
||||
.first
|
||||
.find { |champ| champ.libelle == 'libelleB' }
|
||||
.update(value: 'libelle2')
|
||||
end
|
||||
|
||||
|
|
|
@ -123,13 +123,11 @@ describe TagsSubstitutionConcern, type: :model do
|
|||
context 'and their value in the dossier are not nil' do
|
||||
before do
|
||||
dossier.champs
|
||||
.filter { |champ| champ.libelle == 'libelleA' }
|
||||
.first
|
||||
.find { |champ| champ.libelle == 'libelleA' }
|
||||
.update(value: 'libelle1')
|
||||
|
||||
dossier.champs
|
||||
.filter { |champ| champ.libelle == 'libelleB' }
|
||||
.first
|
||||
.find { |champ| champ.libelle == 'libelleB' }
|
||||
.update(value: 'libelle2')
|
||||
end
|
||||
|
||||
|
@ -151,8 +149,7 @@ describe TagsSubstitutionConcern, type: :model do
|
|||
context 'and their value in the dossier are not nil' do
|
||||
before do
|
||||
dossier.champs
|
||||
.filter { |champ| champ.libelle == "Intitulé de l'‘«\"évènement\"»’" }
|
||||
.first
|
||||
.find { |champ| champ.libelle == "Intitulé de l'‘«\"évènement\"»’" }
|
||||
.update(value: 'ceci est mon évènement')
|
||||
end
|
||||
|
||||
|
@ -302,13 +299,11 @@ describe TagsSubstitutionConcern, type: :model do
|
|||
context 'and its value in the dossier are not nil' do
|
||||
before do
|
||||
dossier.champs
|
||||
.filter { |champ| champ.type_champ == TypeDeChamp.type_champs.fetch(:date) }
|
||||
.first
|
||||
.find { |champ| champ.type_champ == TypeDeChamp.type_champs.fetch(:date) }
|
||||
.update(value: '2017-04-15')
|
||||
|
||||
dossier.champs
|
||||
.filter { |champ| champ.type_champ == TypeDeChamp.type_champs.fetch(:datetime) }
|
||||
.first
|
||||
.find { |champ| champ.type_champ == TypeDeChamp.type_champs.fetch(:datetime) }
|
||||
.update(value: '2017-09-13 09:00')
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue