about summary refs log tree commit diff
path: root/spec/models/account_spec.rb
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2018-11-27 12:28:01 +0100
committerEugen Rochko <eugen@zeonfederated.com>2018-11-27 12:28:01 +0100
commit395615d9f3c521824f7e56f6d1bb2d82b8e421b4 (patch)
treee6e1821481ee41819e582d1d03811c2a3bc7c0a6 /spec/models/account_spec.rb
parentd5fac45f5b3501e923401a12a9b18d225b19232a (diff)
Allow hyphens in the middle of remote user names (#9345)
Fixes #9309

This only allows hyphens in the middle of a username, much like dots,
although I don't have a compelling reason to do so other than keeping
the changes minimal.
Diffstat (limited to 'spec/models/account_spec.rb')
-rw-r--r--spec/models/account_spec.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb
index 9133616a2..f7f78d34c 100644
--- a/spec/models/account_spec.rb
+++ b/spec/models/account_spec.rb
@@ -618,9 +618,15 @@ RSpec.describe Account, type: :model do
         expect(account).not_to model_have_error_on_field(:username)
       end
 
-      it 'is invalid if the username doesn\'t only contains letters, numbers and underscores' do
+      it 'is valid even if the username contains hyphens' do
         account = Fabricate.build(:account, domain: 'domain', username: 'the-doctor')
         account.valid?
+        expect(account).to_not model_have_error_on_field(:username)
+      end
+
+      it 'is invalid if the username doesn\'t only contains letters, numbers, underscores and hyphens' do
+        account = Fabricate.build(:account, domain: 'domain', username: 'the doctor')
+        account.valid?
         expect(account).to model_have_error_on_field(:username)
       end