about summary refs log tree commit diff
path: root/spec/models
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-03-13 16:55:07 +0100
committerGitHub <noreply@github.com>2019-03-13 16:55:07 +0100
commit3005e473a0df4d2ea942dcc33e01c5e4c15b81fa (patch)
tree8d0b0e635bf12a56ae99278ab206684da2a9aad1 /spec/models
parentc2857c976c7d4a8bbd02c3c18569913f2bf8a034 (diff)
parent387f253f3100317ae247928aa9168f431879ecb6 (diff)
Merge pull request #957 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/account_spec.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb
index a43421b76..379872316 100644
--- a/spec/models/account_spec.rb
+++ b/spec/models/account_spec.rb
@@ -558,6 +558,11 @@ RSpec.describe Account, type: :model do
       expect(account).to model_have_error_on_field(:username)
     end
 
+    it 'squishes the username before validation' do
+      account = Fabricate(:account, domain: nil, username: " \u3000bob \t \u00a0 \n ")
+      expect(account.username).to eq 'bob'
+    end
+
     context 'when is local' do
       it 'is invalid if the username is not unique in case-insensitive comparison among local accounts' do
         account_1 = Fabricate(:account, username: 'the_doctor')