about summary refs log tree commit diff
path: root/spec/models/account_spec.rb
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-07-24 16:53:25 +0200
committerGitHub <noreply@github.com>2019-07-24 16:53:25 +0200
commit88e79c179a1a48feff3b16226c46f5885442651e (patch)
tree020d6a6ef6b4a236f14d6287e4ff97c0750db3c9 /spec/models/account_spec.rb
parente3a551cbd1f894fa779dc55168e56bb5f07b3d72 (diff)
parent2d35e4460a6c55930568d4b19563f9894d89e79b (diff)
Merge pull request #1176 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'spec/models/account_spec.rb')
-rw-r--r--spec/models/account_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb
index 6495a6193..3a17d540a 100644
--- a/spec/models/account_spec.rb
+++ b/spec/models/account_spec.rb
@@ -583,12 +583,29 @@ RSpec.describe Account, type: :model do
         expect(account.valid?).to be true
       end
 
+      it 'is valid if we are creating an instance actor account with a period' do
+        account = Fabricate.build(:account, id: -99, actor_type: 'Application', locked: true, username: 'example.com')
+        expect(account.valid?).to be true
+      end
+
+      it 'is valid if we are creating a possibly-conflicting instance actor account' do
+        account_1 = Fabricate(:account, username: 'examplecom')
+        account_2 = Fabricate.build(:account, id: -99, actor_type: 'Application', locked: true, username: 'example.com')
+        expect(account_2.valid?).to be true
+      end
+
       it 'is invalid if the username doesn\'t only contains letters, numbers and underscores' do
         account = Fabricate.build(:account, username: 'the-doctor')
         account.valid?
         expect(account).to model_have_error_on_field(:username)
       end
 
+      it 'is invalid if the username contains a period' do
+        account = Fabricate.build(:account, username: 'the.doctor')
+        account.valid?
+        expect(account).to model_have_error_on_field(:username)
+      end
+
       it 'is invalid if the username is longer then 30 characters' do
         account = Fabricate.build(:account, username: Faker::Lorem.characters(31))
         account.valid?