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
path: root/spec
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-02-13 03:39:34 +0300
committerDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-02-13 03:39:34 +0300
commit2ff1b8e68d085a8b43507630b3986743d2a48145 (patch)
treef4bddd1e332478a8ff4c63d5cf29d7d55e621dce /spec
parentf9880c11f754c278cbd00eb34ea65e90160571db (diff)
parent6685661b549cdece3b93131af168b5174bc0403f (diff)
Merge branch 'clean-oauth-username' into 'master'
Clean username acquired from OAuth/LDAP. Fixes #1967. Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/813 See merge request !1500
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/oauth/user_spec.rb2
-rw-r--r--spec/models/user_spec.rb10
2 files changed, 11 insertions, 1 deletions
diff --git a/spec/lib/gitlab/oauth/user_spec.rb b/spec/lib/gitlab/oauth/user_spec.rb
index 88307515789..2680794a747 100644
--- a/spec/lib/gitlab/oauth/user_spec.rb
+++ b/spec/lib/gitlab/oauth/user_spec.rb
@@ -8,7 +8,7 @@ describe Gitlab::OAuth::User do
let(:auth_hash) { double(uid: uid, provider: provider, info: double(info_hash)) }
let(:info_hash) do
{
- nickname: 'john',
+ nickname: '-john+gitlab-ETC%.git@gmail.com',
name: 'John',
email: 'john@mail.com'
}
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) }