fix(Champs::EngagementJuridiqueChamp): validates Champs::EngagementJuridiqueChamp respecting it's validation context.
This commit is contained in:
parent
ff527517c9
commit
284a10e235
2 changed files with 2 additions and 2 deletions
|
@ -3,5 +3,5 @@ class Champs::EngagementJuridiqueChamp < Champ
|
|||
validates_with ExpressionReguliereValidator,
|
||||
expression_reguliere: /([A-Z]|[0-9]|\-|\_|\+|\/)+/,
|
||||
expression_reguliere_error_message: "Le numéro d'EJ ne peut contenir que des caractères alphanumérique et les caractères spéciaux suivant : “-“ ; “_“ ; “+“ ; “/“",
|
||||
if: -> { validation_context != :brouillon }
|
||||
if: :validate_champ_value?
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
describe Champs::EngagementJuridiqueChamp do
|
||||
describe 'validation' do
|
||||
let(:champ) { build(:champ_engagement_juridique, value: value) }
|
||||
subject { champ.valid? }
|
||||
subject { champ.validate(:champs_public_value) }
|
||||
|
||||
context 'with [A-Z]' do
|
||||
let(:value) { "ABC" }
|
||||
|
|
Loading…
Reference in a new issue