FIX: Always validate presence of user's primary_email.
This commit is contained in:
parent
b059a0f789
commit
24e0e000b9
|
@ -81,7 +81,7 @@ class User < ActiveRecord::Base
|
|||
validate :password_validator
|
||||
validates :name, user_full_name: true, if: :name_changed?, length: { maximum: 255 }
|
||||
validates :ip_address, allowed_ip_address: { on: :create, message: :signup_not_allowed }
|
||||
validates :primary_email, presence: true, if: :should_validate_primary_email?
|
||||
validates :primary_email, presence: true
|
||||
validates_associated :primary_email, if: :should_validate_primary_email?
|
||||
|
||||
after_initialize :add_trust_level
|
||||
|
|
|
@ -5,6 +5,7 @@ describe User do
|
|||
|
||||
context 'validations' do
|
||||
it { is_expected.to validate_presence_of :username }
|
||||
it { is_expected.to validate_presence_of :primary_email }
|
||||
|
||||
describe 'emails' do
|
||||
let(:user) { Fabricate.build(:user) }
|
||||
|
|
Loading…
Reference in New Issue