Commit e79e2ae1 authored by Alexis Reigel's avatar Alexis Reigel

validate presence of user on gpg_key

parent d9fd3709
......@@ -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) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment