validate presence of user on gpg_key
This commit is contained in:
parent
d9fd3709ab
commit
e79e2ae1f4
|
@ -6,6 +6,8 @@ class GpgKey < ActiveRecord::Base
|
|||
belongs_to :user
|
||||
has_many :gpg_signatures, dependent: :nullify
|
||||
|
||||
validates :user, presence: true
|
||||
|
||||
validates :key,
|
||||
presence: true,
|
||||
uniqueness: true,
|
||||
|
|
|
@ -6,6 +6,7 @@ describe GpgKey do
|
|||
end
|
||||
|
||||
describe "validation" do
|
||||
it { is_expected.to validate_presence_of(:user) }
|
||||
it { is_expected.to validate_presence_of(:key) }
|
||||
it { is_expected.to validate_uniqueness_of(:key) }
|
||||
it { is_expected.to allow_value("-----BEGIN PGP PUBLIC KEY BLOCK-----\nkey").for(:key) }
|
||||
|
|
Loading…
Reference in New Issue