-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from fredngo/master
Namespace EmailValidator under the ValidEmail2 namespace.
- Loading branch information
Showing
9 changed files
with
58 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
source "https://rubygems.org" | ||
source 'https://rubygems.org' | ||
|
||
gem "activemodel", "~> 3.2.13" | ||
gem 'activemodel', '~> 3.2.22' | ||
|
||
gemspec path: "../" | ||
gemspec path: '../' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
source "https://rubygems.org" | ||
source 'https://rubygems.org' | ||
|
||
gem "activemodel", "~> 4.2.0" | ||
gem 'activemodel', '~> 4.2.9' | ||
|
||
gemspec path: "../" | ||
gemspec path: '../' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'activemodel', '~> 5.1.2' | ||
|
||
gemspec path: '../' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# This is a shim for keeping backwards compatibility. | ||
# See the discussion in: https://github.com/lisinge/valid_email2/pull/79 | ||
class EmailValidator < ValidEmail2::EmailValidator | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
require "spec_helper" | ||
|
||
class TestUser < TestModel | ||
validates :email, email: true | ||
validates :email, 'valid_email_2/email': true | ||
end | ||
|
||
class TestUserMX < TestModel | ||
validates :email, email: { mx: true } | ||
validates :email, 'valid_email_2/email': { mx: true } | ||
end | ||
|
||
class TestUserDisallowDisposable < TestModel | ||
validates :email, email: { disposable: true } | ||
validates :email, 'valid_email_2/email': { disposable: true } | ||
end | ||
|
||
class TestUserDisallowBlacklisted < TestModel | ||
validates :email, email: { blacklist: true } | ||
validates :email, 'valid_email_2/email': { blacklist: true } | ||
end | ||
|
||
class BackwardsCompatibleUser < TestModel | ||
validates :email, email: true | ||
end | ||
|
||
describe ValidEmail2 do | ||
|
@@ -44,6 +48,11 @@ class TestUserDisallowBlacklisted < TestModel | |
user = TestUser.new(email: "[email protected]") | ||
expect(user.valid?).to be_falsey | ||
end | ||
|
||
it "still works with the backwards-compatible syntax" do | ||
user = BackwardsCompatibleUser.new(email: "[email protected]") | ||
expect(user.valid?).to be_truthy | ||
end | ||
end | ||
|
||
describe "disposable emails" do | ||
|