From c207b4bb330463c39c202d1c66e2447b55332093 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 8 Jun 2017 15:22:01 +0200 Subject: 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 --- spec/models/account_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'spec/models/account_spec.rb') 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') -- cgit