about summary refs log tree commit diff
path: root/app/validators
diff options
context:
space:
mode:
authorMatt Jankowski <matt@jankowski.online>2023-03-04 11:00:00 -0500
committerGitHub <noreply@github.com>2023-03-04 17:00:00 +0100
commitc40d5e5a8fb02f2c603a23a1b0130b3f86a15710 (patch)
treec9c107c48bf66a957ffc70d72c41fc066a4560e7 /app/validators
parent2f606ba1220edf29e805296939f4e5612721bbf0 (diff)
Misc coverage improvements for validators (#23928)
Diffstat (limited to 'app/validators')
-rw-r--r--app/validators/ed25519_key_validator.rb2
-rw-r--r--app/validators/ed25519_signature_validator.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/app/validators/ed25519_key_validator.rb b/app/validators/ed25519_key_validator.rb
index 00a448d5a..adf49296b 100644
--- a/app/validators/ed25519_key_validator.rb
+++ b/app/validators/ed25519_key_validator.rb
@@ -6,7 +6,7 @@ class Ed25519KeyValidator < ActiveModel::EachValidator
 
     key = Base64.decode64(value)
 
-    record.errors[attribute] << I18n.t('crypto.errors.invalid_key') unless verified?(key)
+    record.errors.add(attribute, I18n.t('crypto.errors.invalid_key')) unless verified?(key)
   end
 
   private
diff --git a/app/validators/ed25519_signature_validator.rb b/app/validators/ed25519_signature_validator.rb
index 77a21b837..0e74c231e 100644
--- a/app/validators/ed25519_signature_validator.rb
+++ b/app/validators/ed25519_signature_validator.rb
@@ -8,7 +8,7 @@ class Ed25519SignatureValidator < ActiveModel::EachValidator
     signature  = Base64.decode64(value)
     message    = option_to_value(record, :message)
 
-    record.errors[attribute] << I18n.t('crypto.errors.invalid_signature') unless verified?(verify_key, signature, message)
+    record.errors.add(attribute, I18n.t('crypto.errors.invalid_signature')) unless verified?(verify_key, signature, message)
   end
 
   private