Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Neulinger <nneul@neulinger.org>2017-04-10 16:02:31 +0300
committerNathan Neulinger <nneul@neulinger.org>2017-07-12 15:48:48 +0300
commit4f47de62b47e136ffe335dc93acff3f6cd69b98f (patch)
tree502f26a0d6e44abd99a1e621b4880267b0ab82a6 /spec/models/user_spec.rb
parent571c4f5a4f1b9f6a21f3f3af462fac4c1ea5f42a (diff)
Stop sanitizing user 'name' when inserting into db
Add spec tests for encoding
Diffstat (limited to 'spec/models/user_spec.rb')
-rw-r--r--spec/models/user_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index d04162a527f..c70f916a8bd 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1159,6 +1159,18 @@ describe User, models: true do
end
end
+ describe '#sanitize_attrs' do
+ let(:user) { build(:user, name: 'test & user', skype: 'test&user') }
+
+ it 'encodes HTML entities in the Skype attribute' do
+ expect { user.sanitize_attrs }.to change { user.skype }.to('test&amp;user')
+ end
+
+ it 'does not encode HTML entities in the name attribute' do
+ expect { user.sanitize_attrs }.not_to change { user.name }
+ end
+ end
+
describe '#starred?' do
it 'determines if user starred a project' do
user = create :user