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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-06-30 14:44:41 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-06-30 14:45:05 +0300
commita262d7269b9dc9060f3f5b3de0976d8058c1b580 (patch)
tree4f1f9ef013ba07def9445f48fa3c7d2dc6277cf4 /spec/models/user_spec.rb
parentaa5a29806f359945ec3483906a4e40ec71362a61 (diff)
Add latest changes from gitlab-org/security/gitlab@14-0-stable-ee
Diffstat (limited to 'spec/models/user_spec.rb')
-rw-r--r--spec/models/user_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index dc78ec2be21..2185df0609e 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -387,6 +387,19 @@ RSpec.describe User do
expect(user.errors.full_messages).to eq(['Username has already been taken'])
end
end
+
+ it 'validates format' do
+ Mime::EXTENSION_LOOKUP.keys.each do |type|
+ user = build(:user, username: "test.#{type}")
+
+ expect(user).not_to be_valid
+ expect(user.errors.full_messages).to include('Username ending with MIME type format is not allowed.')
+ end
+ end
+
+ it 'validates format on updated record' do
+ expect(create(:user).update(username: 'profile.html')).to be_falsey
+ end
end
it 'has a DB-level NOT NULL constraint on projects_limit' do