mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:21:18 +08:00
Merge pull request #4618 from tgxworld/fix_invalid_emails
FIX: Don't allow invalid email to be saved.
This commit is contained in:
@ -3,8 +3,29 @@ require_dependency 'user'
|
||||
|
||||
describe User do
|
||||
|
||||
it { is_expected.to validate_presence_of :username }
|
||||
it { is_expected.to validate_presence_of :email }
|
||||
context 'validations' do
|
||||
it { is_expected.to validate_presence_of :username }
|
||||
|
||||
describe 'emails' do
|
||||
let(:user) { Fabricate.build(:user) }
|
||||
|
||||
it { is_expected.to validate_presence_of :email }
|
||||
|
||||
describe 'when record has a valid email' do
|
||||
it "should be valid" do
|
||||
user.email = 'test@gmail.com'
|
||||
expect(user).to be_valid
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when record has an invalid email' do
|
||||
it 'should not be valid' do
|
||||
user.email = 'test@gmailcom'
|
||||
expect(user).to_not be_valid
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#count_by_signup_date' do
|
||||
before(:each) do
|
||||
|
Reference in New Issue
Block a user