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:
authorDouwe Maan <douwe@gitlab.com>2015-02-11 16:12:43 +0300
committerDouwe Maan <douwe@gitlab.com>2015-02-12 23:05:27 +0300
commit6685661b549cdece3b93131af168b5174bc0403f (patch)
tree07daec6105e14e906dcdfb7fd1d01a5fb6b13289 /spec/models/user_spec.rb
parent2dfd21983483bd5fd32b327edb4b02228b377c47 (diff)
Clean username acquired from OAuth/LDAP.
Fixes #1967.
Diffstat (limited to 'spec/models/user_spec.rb')
-rw-r--r--spec/models/user_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 629d51b960d..7473054f481 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -301,6 +301,16 @@ describe User do
end
end
+ describe ".clean_username" do
+
+ let!(:user1) { create(:user, username: "johngitlab-etc") }
+ let!(:user2) { create(:user, username: "JohnGitLab-etc1") }
+
+ it "cleans a username and makes sure it's available" do
+ expect(User.clean_username("-john+gitlab-ETC%.git@gmail.com")).to eq("johngitlab-ETC2")
+ end
+ end
+
describe 'all_ssh_keys' do
it { should have_many(:keys).dependent(:destroy) }