diff options
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/account_spec.rb | 6 | ||||
-rw-r--r-- | spec/models/user_spec.rb | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index ab4de9aa1..73ae34f8e 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -387,6 +387,12 @@ RSpec.describe Account, type: :model do expect(account).to model_have_error_on_field(:username) end + it 'is valid when username is reserved but record has already been created' do + account = Fabricate.build(:account, username: 'support') + account.save(validate: false) + expect(account.valid?).to be true + end + context 'when is local' do it 'is invalid if the username doesn\'t only contains letters, numbers and underscores' do account = Fabricate.build(:account, username: 'the-doctor') diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 13a60f668..a6df3fb26 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -34,6 +34,12 @@ RSpec.describe User, type: :model do expect(user).to model_have_error_on_field(:email) end + it 'is valid with an invalid e-mail that has already been saved' do + user = Fabricate.build(:user, email: 'invalid-email') + user.save(validate: false) + expect(user.valid?).to be true + end + it 'cleans out empty string from languages' do user = Fabricate.build(:user, filtered_languages: ['']) user.valid? |