diff options
author | Rubén Dávila <ruben@gitlab.com> | 2017-09-28 21:26:16 +0300 |
---|---|---|
committer | Rubén Dávila <ruben@gitlab.com> | 2017-10-05 16:25:27 +0300 |
commit | b27549df97151f773c6fbfac4c9dc3aa491a8b5d (patch) | |
tree | 2eeb19000452adf02914e583020d9e024327ac2d /app | |
parent | 4b6d045c0c3c8d8ab70dd80feb960f193e498d7a (diff) |
Add some basic specs and refactor model and validations
Diffstat (limited to 'app')
-rw-r--r-- | app/models/gpg_key_subkey.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/gpg_key_subkey.rb b/app/models/gpg_key_subkey.rb index 8222e5606aa..b4f146e5647 100644 --- a/app/models/gpg_key_subkey.rb +++ b/app/models/gpg_key_subkey.rb @@ -6,6 +6,17 @@ class GpgKeySubkey < ActiveRecord::Base belongs_to :gpg_key + validates :gpg_key_id, presence: true + validates :fingerprint, :keyid, presence: true, uniqueness: true + + def keyid + super&.upcase + end + + def fingerprint + super&.upcase + end + def method_missing(m, *a, &b) return super unless gpg_key.respond_to?(m) |