-
Notifications
You must be signed in to change notification settings - Fork 269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
validates uniqueness of email #590
base: development
Are you sure you want to change the base?
Conversation
|
||
describe "uniqueness of email" do | ||
let!(:existing_user) { create(:user, email: "another@email.com") } | ||
it "validates the uniqueness of email" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
@@ -96,4 +96,12 @@ | |||
expect(user.acronyms).to eq "AS" | |||
end | |||
end | |||
|
|||
describe "uniqueness of email" do | |||
let!(:existing_user) { create(:user, email: "another@email.com") } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
@@ -96,4 +96,12 @@ | |||
expect(user.acronyms).to eq "AS" | |||
end | |||
end | |||
|
|||
describe "uniqueness of email" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
@@ -74,4 +76,8 @@ def color | |||
def acronyms | |||
first_name[0] + last_name[0] | |||
end | |||
|
|||
def unique_email_address? | |||
return false if User.where(email: self.email).any? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/RedundantSelf: Redundant self detected.
Corresponding Issue
#589