summaryrefslogtreecommitdiff
path: root/spec/models/user_spec.rb
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2018-02-15 13:30:56 +0000
committerRémy Coutable <remy@rymai.me>2018-02-15 13:30:56 +0000
commit98e4d4083a7d734b7f60402041aa59fa66309cac (patch)
tree261ab0ad474dd85715221bdbe84b8929c82609cb /spec/models/user_spec.rb
parentba0d45c439ae33f15254158069f5434988402d18 (diff)
parenteddf4c0f6cb6125a30cbc2528a468d2c3d5a48e0 (diff)
downloadgitlab-ce-98e4d4083a7d734b7f60402041aa59fa66309cac.tar.gz
Merge branch 'change/strip-whitespace-from-username-input#42637' into 'master'
Trim whitespace from input in the username/email form field Closes #42637 See merge request gitlab-org/gitlab-ce!17020
Diffstat (limited to 'spec/models/user_spec.rb')
-rw-r--r--spec/models/user_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 76a6aef39cc..1815696a8a0 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -893,6 +893,14 @@ describe User do
end
end
+ describe '.find_for_database_authentication' do
+ it 'strips whitespace from login' do
+ user = create(:user)
+
+ expect(described_class.find_for_database_authentication({ login: " #{user.username} " })).to eq user
+ end
+ end
+
describe '.find_by_any_email' do
it 'finds by primary email' do
user = create(:user, email: 'foo@example.com')