Skip to content

Commit

Permalink
Merge pull request #9965 from colinux/fix-rna-format
Browse files Browse the repository at this point in the history
ETQ usager je peux saisir un numéro RNA valide qui ne contient pas que des chiffres
  • Loading branch information
colinux authored Feb 6, 2024
2 parents 6945bf2 + fb14afc commit e9950a2
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
fr:
title: "Le numéro RNA doit commencer par un W majuscule suivi de 9 chiffres"
title: "Le numéro RNA doit commencer par un W majuscule suivi de 9 chiffres et lettres"
2 changes: 1 addition & 1 deletion app/models/champs/rna_champ.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class Champs::RNAChamp < Champ
include RNAChampAssociationFetchableConcern

validates :value, allow_blank: true, format: {
with: /\AW[0-9]{9}\z/, message: I18n.t(:not_a_rna, scope: 'activerecord.errors.messages')
with: /\AW[0-9A-Z]{9}\z/, message: I18n.t(:not_a_rna, scope: 'activerecord.errors.messages')
}, if: :validate_champ_value?

delegate :id, to: :procedure, prefix: true
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/champs/rna/_association.html.haml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- case error
- when :invalid
%p.fr-error-text
Le numéro RNA doit commencer par un W majuscule suivi de 9 chiffres
Le numéro RNA doit commencer par un W majuscule suivi de 9 chiffres ou lettres
- when :not_found
%p.fr-error-text= t('.not_found')
- when :network_error
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/champs/rna_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
end

it 'displays a “RNA is invalid” error message' do
expect(response.body).to include("Le numéro RNA doit commencer par un W majuscule suivi de 9 chiffres")
expect(response.body).to include("Le numéro RNA doit commencer par un W majuscule suivi de 9 chiffres ou lettres")
end
end

Expand Down

0 comments on commit e9950a2

Please sign in to comment.