Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
843b1de0
Commit
843b1de0
authored
Jul 25, 2017
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify nil handling
parent
14551424
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
app/models/gpg_key.rb
app/models/gpg_key.rb
+1
-2
spec/models/gpg_key_spec.rb
spec/models/gpg_key_spec.rb
+4
-0
No files found.
app/models/gpg_key.rb
View file @
843b1de0
...
...
@@ -46,8 +46,7 @@ class GpgKey < ActiveRecord::Base
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 @
843b1de0
...
...
@@ -44,6 +44,10 @@ describe GpgKey do
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