Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
7e200e491d20
Commit
e79e2ae1
authored
Jul 05, 2017
by
Alexis Reigel
Browse files
validate presence of user on gpg_key
parent
9e63978127dd
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/models/gpg_key.rb
View file @
7e200e49
...
...
@@ -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
,
...
...
spec/models/gpg_key_spec.rb
View file @
7e200e49
...
...
@@ -6,6 +6,7 @@
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-----
\n
key"
).
for
(
:key
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment