add fake mail validation

This commit is contained in:
pixeldesu 2015-07-21 22:44:14 +02:00
parent 54e27896f4
commit 5366c3c748
3 changed files with 7 additions and 0 deletions

View File

@ -66,6 +66,8 @@ gem 'tumblr_client'
gem 'foreman' gem 'foreman'
gem 'redis' gem 'redis'
gem 'fake_email_validator'
group :development do group :development do
# require spring 1.3.5 since shit's on fire on my local instance with 1.3.4 (Gem::LoadError) # require spring 1.3.5 since shit's on fire on my local instance with 1.3.4 (Gem::LoadError)
gem 'spring', '~> 1.3.5' gem 'spring', '~> 1.3.5'

View File

@ -115,6 +115,9 @@ GEM
factory_girl_rails (4.5.0) factory_girl_rails (4.5.0)
factory_girl (~> 4.5.0) factory_girl (~> 4.5.0)
railties (>= 3.0.0) railties (>= 3.0.0)
fake_email_validator (1.0.11)
activemodel
mail
faker (1.4.3) faker (1.4.3)
i18n (~> 0.5) i18n (~> 0.5)
faraday (0.9.1) faraday (0.9.1)
@ -496,6 +499,7 @@ DEPENDENCIES
devise-async devise-async
devise-i18n devise-i18n
factory_girl_rails factory_girl_rails
fake_email_validator
faker faker
fog fog
fog-aws fog-aws

View File

@ -38,6 +38,7 @@ class User < ActiveRecord::Base
screen_name.strip! screen_name.strip!
end end
validates :email, fake_email: true
validates :screen_name, presence: true, format: { with: SCREEN_NAME_REGEX }, uniqueness: { case_sensitive: false }, screen_name: true validates :screen_name, presence: true, format: { with: SCREEN_NAME_REGEX }, uniqueness: { case_sensitive: false }, screen_name: true
validates :display_name, length: { maximum: 50 } validates :display_name, length: { maximum: 50 }