diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-06-08 15:22:01 +0200 |
---|---|---|
committer | Matt Jankowski <mjankowski@thoughtbot.com> | 2017-06-08 09:22:01 -0400 |
commit | c207b4bb330463c39c202d1c66e2447b55332093 (patch) | |
tree | 932150591bd43dc2c4b3490f9be29132911b1bf6 /spec/models/account_spec.rb | |
parent | b87eb8ea146a54fcfd2533f47622070d0f30a9fa (diff) |
Fix db:seed - only run some validations when the field was changed (#3592)
* Fix db:seed - only run some validations when the field was changed * Add tests
Diffstat (limited to 'spec/models/account_spec.rb')
-rw-r--r-- | spec/models/account_spec.rb | 6 |
1 files changed, 6 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') |