FIX: Staged users are still missing primary email.

This commit is contained in:
Guo Xiang Tan
2017-08-09 11:56:08 +09:00
parent c4b49fbabe
commit 0bc690ed11
6 changed files with 54 additions and 40 deletions

View File

@ -28,9 +28,9 @@ describe User do
end
describe 'when user is staged' do
it 'should still validate primary_email' do
it 'should still validate presence of primary_email' do
user.staged = true
user.primary_email = nil
user.email = nil
expect(user).to_not be_valid
expect(user.errors.messages).to include(:primary_email)
@ -623,7 +623,10 @@ describe User do
it "doesn't validate email address for staged users" do
SiteSetting.email_domains_whitelist = "foo.com"
SiteSetting.email_domains_blacklist = "bar.com"
expect(Fabricate.build(:user, staged: true, email: "foo@bar.com")).to be_valid
user = Fabricate.build(:user, staged: true, email: "foo@bar.com")
expect(user.save).to eq(true)
end
end