Commit 843b1de0 authored by Alexis Reigel's avatar Alexis Reigel

simplify nil handling

parent 14551424
......@@ -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
......
......@@ -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
......
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