Commit 14c1d699 authored by Alexis Reigel's avatar Alexis Reigel
Browse files

simplify nil handling

parent 5e55b8ac97fb
...@@ -46,8 +46,7 @@ ...@@ -46,8 +46,7 @@
end end
def key=(value) def key=(value)
value.strip! unless value.blank? super(value&.strip)
write_attribute(:key, value)
end end
def user_infos def user_infos
......
...@@ -44,6 +44,10 @@ ...@@ -44,6 +44,10 @@
expect(described_class.new(key: " #{key} ").key).to eq(key) expect(described_class.new(key: " #{key} ").key).to eq(key)
end end
it 'does not strip when the key is nil' do
expect(described_class.new(key: nil).key).to be_nil
end
end end
describe '#user_infos' do describe '#user_infos' do
......
Supports Markdown
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