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
14c1d6994c2f
Commit
843b1de0
authored
Jul 25, 2017
by
Alexis Reigel
Browse files
simplify nil handling
parent
5e55b8ac97fb
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/models/gpg_key.rb
View file @
14c1d699
...
...
@@ -46,8 +46,7 @@ def fingerprint
end
def
key
=
(
value
)
value
.
strip!
unless
value
.
blank?
write_attribute
(
:key
,
value
)
super
(
value
&
.
strip
)
end
def
user_infos
...
...
spec/models/gpg_key_spec.rb
View file @
14c1d699
...
...
@@ -44,6 +44,10 @@
expect
(
described_class
.
new
(
key:
"
#{
key
}
"
).
key
).
to
eq
(
key
)
end
it
'does not strip when the key is nil'
do
expect
(
described_class
.
new
(
key:
nil
).
key
).
to
be_nil
end
end
describe
'#user_infos'
do
...
...
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