email_validator 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +0 -4
- data/Changes.md +5 -0
- data/email_validator.gemspec +1 -1
- data/lib/email_validator.rb +1 -1
- data/spec/email_validator_spec.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ede74c324c144cfd01a3f13a1782ecb45af661a794ac8361d9193939a1973174
|
4
|
+
data.tar.gz: 4a8dad3331c014a855e03fbcf40f2cdfdb4e0cc6f216775d579b571f8276cc0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 108a2f115956ceb9b3f53e9dac871589efc9169e99789cc0c7a5339fbcaa063e9b47f6872b9b9836fa19b53d6e42fade76fa33961b8896bf382cf54ff9aad53f
|
7
|
+
data.tar.gz: 7cde7e0065099b6b5739338190dc6712dd5d8781892f5d645a13f24b5f4c1f328d563fb324a74782fcae307a4786bfb025acd4a33250b65c8f6c9ab028626bcc
|
data/.travis.yml
CHANGED
data/Changes.md
CHANGED
data/email_validator.gemspec
CHANGED
data/lib/email_validator.rb
CHANGED
@@ -23,7 +23,7 @@ class EmailValidator < ActiveModel::EachValidator
|
|
23
23
|
|
24
24
|
def validate_each(record, attribute, value)
|
25
25
|
if self.class.invalid?(value)
|
26
|
-
record.errors.add(attribute, options
|
26
|
+
record.errors.add(attribute, :invalid, options.slice(:message).merge(value: value))
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -128,6 +128,15 @@ describe EmailValidator do
|
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
|
+
describe "error details" do
|
132
|
+
subject { TestUser.new :email => 'invalidemail@' }
|
133
|
+
before { subject.valid? }
|
134
|
+
|
135
|
+
it "should add the default message" do
|
136
|
+
expect(subject.errors.details[:email]).to eq [{ error: :invalid, value: 'invalidemail@' }]
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
131
140
|
describe "nil email" do
|
132
141
|
it "should not be valid when :allow_nil option is missing" do
|
133
142
|
expect(TestUser.new(:email => nil)).not_to be_valid
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: email_validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Alexander
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|