diff --git a/app/models/user.rb b/app/models/user.rb index 61c7799127b..59c7981181e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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 diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 3d270e1c843..b26b326781b 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -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) }