Commit 0e6ef209 authored by Michael Kozono's avatar Michael Kozono

Avoid copy paste problems

parent 19ade869
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
class GeoNode < ApplicationRecord class GeoNode < ApplicationRecord
include Presentable include Presentable
include Geo::SelectiveSync include Geo::SelectiveSync
include StripAttribute
SELECTIVE_SYNC_TYPES = %w[namespaces shards].freeze SELECTIVE_SYNC_TYPES = %w[namespaces shards].freeze
...@@ -55,6 +56,8 @@ class GeoNode < ApplicationRecord ...@@ -55,6 +56,8 @@ class GeoNode < ApplicationRecord
mode: :per_attribute_iv, mode: :per_attribute_iv,
encode: true encode: true
strip_attributes :name
class << self class << self
# Set in gitlab.rb as external_url # Set in gitlab.rb as external_url
def current_node_url def current_node_url
......
...@@ -671,4 +671,16 @@ describe GeoNode, :geo, type: :model do ...@@ -671,4 +671,16 @@ describe GeoNode, :geo, type: :model do
is_expected.to be_falsy is_expected.to be_falsy
end end
end end
describe '#name=' do
context 'before validation' do
it 'strips leading and trailing whitespace' do
node = build(:geo_node)
node.name = " foo\n\n "
node.valid?
expect(node.name).to eq('foo')
end
end
end
end end
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