activevalidators 3.3.0 → 4.0.0
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.travis.yml +4 -4
- data/ChangeLog.md +19 -0
- data/README.md +37 -7
- data/activevalidators.gemspec +9 -7
- data/certs/franckverrot.pem +16 -16
- data/checksums/4.0.0.sha512 +1 -0
- data/lib/active_validators/active_model/validations/email_validator.rb +8 -8
- data/lib/active_validators/active_model/validations/phone_validator.rb +15 -3
- data/lib/active_validators/active_model/validations/postal_code_validator.rb +4 -2
- data/lib/active_validators/active_model/validations/siren_validator.rb +1 -1
- data/lib/active_validators/active_model/validations/slug_validator.rb +1 -1
- data/lib/active_validators/active_model/validations/ssn_validator.rb +1 -1
- data/lib/active_validators/active_model/validations/twitter_validator.rb +1 -1
- data/test/test_helper.rb +5 -0
- data/test/validations/credit_card_test.rb +12 -4
- data/test/validations/email_test.rb +4 -2
- data/test/validations/phone_test.rb +16 -1
- data/test/validations/postal_code_test.rb +9 -0
- data/test/validations/ssn_test.rb +5 -3
- data/test/validations/twitter_test.rb +3 -1
- metadata +47 -47
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b46a62793eca8eab4acad356f87af9a41f8932a5
|
4
|
+
data.tar.gz: a3a726567bc55161e5ab7f7f943c10652b87e3ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7bfb56da0c622acc9a971ec3b727acebc4b7cdc8c1a22ef2328634a3e87d0170215676775934eee5adb278f8272075f02cfa1c167da2d98db6dd5eddf77689c
|
7
|
+
data.tar.gz: b38ac58bbbb30bfcf6e4416035ca0fe3409f914c740e1a531cfaa82fa1de712e2a2c16200c6c8ed1a00fbde00f5bb394ae1ae8f23b410b48cc46a82b3e0aaba9
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.travis.yml
CHANGED
data/ChangeLog.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
# UNRELEASED
|
2
2
|
|
3
|
+
# 4.x.y
|
4
|
+
|
5
|
+
## BREAKING CHANGES
|
6
|
+
|
7
|
+
## DEPRECATION
|
8
|
+
|
9
|
+
## CHANGES
|
10
|
+
|
11
|
+
|
12
|
+
# 4.0.0 (Rails 5 support, major update!)
|
13
|
+
|
14
|
+
## BREAKING CHANGES
|
15
|
+
|
16
|
+
* Added support for Rails 5! Big thanks to Ross Penman! (@penman) :tada:
|
17
|
+
* Dropped support for Ruby < 2.2.2
|
18
|
+
* Unping most dependencies
|
19
|
+
|
20
|
+
|
3
21
|
# 3.3.0
|
4
22
|
|
5
23
|
## DEPRECATION
|
@@ -15,6 +33,7 @@
|
|
15
33
|
* Spec: Links to dependency gems for convenience; sorting ; code :sparkles:.
|
16
34
|
* General: Loosen up the dependency on countries
|
17
35
|
|
36
|
+
|
18
37
|
# 3.2.0
|
19
38
|
|
20
39
|
## MAJOR CHANGES
|
data/README.md
CHANGED
@@ -26,19 +26,23 @@ This projects follows [Semantic Versioning a.k.a SemVer](http://semver.org). If
|
|
26
26
|
|
27
27
|
What it means is that you should specify an ActiveValidators version like this :
|
28
28
|
|
29
|
-
|
29
|
+
```ruby
|
30
|
+
gem 'activevalidators', '~> 3.0.0' # <-- mind the patch version
|
31
|
+
```
|
30
32
|
|
31
33
|
Once you have `require`'d the gem, you will have to activate the validators you
|
32
34
|
want to use as ActiveValidators doesn't force you to use them all :
|
33
35
|
|
34
|
-
|
35
|
-
|
36
|
+
```ruby
|
37
|
+
# Activate all the validators
|
38
|
+
ActiveValidators.activate(:all)
|
36
39
|
|
37
|
-
|
38
|
-
|
40
|
+
# Activate only the email and slug validators
|
41
|
+
ActiveValidators.activate(:email, :slug)
|
39
42
|
|
40
|
-
|
41
|
-
|
43
|
+
# Activate only the phone
|
44
|
+
ActiveValidators.activate(:phone)
|
45
|
+
```
|
42
46
|
|
43
47
|
`ActiveValidators.activate` can be called as many times as one wants. It's only
|
44
48
|
a syntactic sugar on top a normal Ruby `require`.
|
@@ -121,6 +125,32 @@ Exhaustive list of supported validators and their implementation:
|
|
121
125
|
* `twitter` : based on a regular expression
|
122
126
|
* `url` : based on a regular expression
|
123
127
|
|
128
|
+
|
129
|
+
### Handling error messages
|
130
|
+
|
131
|
+
The validators rely on ActiveModel validations, and will require one to use its i18n-based mechanism. Here is a basic example:
|
132
|
+
|
133
|
+
```ruby
|
134
|
+
# user.rb
|
135
|
+
|
136
|
+
class User < ActiveRecord::Base
|
137
|
+
validates :email, email: {message: :bad_email}
|
138
|
+
end
|
139
|
+
```
|
140
|
+
|
141
|
+
```yaml
|
142
|
+
# en.yml
|
143
|
+
|
144
|
+
en:
|
145
|
+
activerecord:
|
146
|
+
errors:
|
147
|
+
models:
|
148
|
+
user:
|
149
|
+
attributes:
|
150
|
+
email:
|
151
|
+
bad_email: "your error message"
|
152
|
+
```
|
153
|
+
|
124
154
|
## Todo
|
125
155
|
|
126
156
|
Lots of improvements can be made:
|
data/activevalidators.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.name = 'activevalidators'
|
4
|
-
s.version = '
|
4
|
+
s.version = '4.0.0'
|
5
5
|
s.platform = Gem::Platform::RUBY
|
6
6
|
s.authors = ['Franck Verrot', 'Paco Guzmán', 'Oriol Gual', 'Garrett Bjerkhoel', 'Renato Riccieri Santos Zannon', 'Brian Moseley', 'Serj L aka Loremaster']
|
7
7
|
s.email = ['franck@verrot.fr']
|
@@ -10,15 +10,17 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.description = %q{ActiveValidators is a collection of ActiveModel/ActiveRecord validations}
|
11
11
|
s.license = 'MIT'
|
12
12
|
|
13
|
+
s.required_ruby_version = '>= 2.2.2'
|
14
|
+
|
13
15
|
s.add_development_dependency 'bundler'
|
14
|
-
s.add_development_dependency 'minitest'
|
15
|
-
s.add_dependency 'rake'
|
16
|
-
s.add_dependency 'activemodel' , '>= 3.0.0'
|
17
|
-
s.add_dependency 'phony' , '>= 1.9.0'
|
18
|
-
s.add_dependency 'countries' , '>= 0.9.3'
|
16
|
+
s.add_development_dependency 'minitest'
|
17
|
+
s.add_dependency 'rake'
|
19
18
|
s.add_dependency 'mail'
|
20
19
|
s.add_dependency 'date_validator'
|
21
|
-
s.add_dependency '
|
20
|
+
s.add_dependency 'activemodel' , '>= 3.0'
|
21
|
+
s.add_dependency 'phony' , '~> 2.0'
|
22
|
+
s.add_dependency 'countries' , '~> 1.2'
|
23
|
+
s.add_dependency 'credit_card_validations', '~> 3.2'
|
22
24
|
|
23
25
|
s.files = `git ls-files`.split("\n")
|
24
26
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
data/certs/franckverrot.pem
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
2
2
|
MIIDaDCCAlCgAwIBAgIBATANBgkqhkiG9w0BAQUFADA9MQ8wDQYDVQQDDAZmcmFu
|
3
3
|
Y2sxFjAUBgoJkiaJk/IsZAEZFgZ2ZXJyb3QxEjAQBgoJkiaJk/IsZAEZFgJmcjAe
|
4
|
-
|
4
|
+
Fw0xNjA1MTMxOTQ3NTlaFw0xNzA1MTMxOTQ3NTlaMD0xDzANBgNVBAMMBmZyYW5j
|
5
5
|
azEWMBQGCgmSJomT8ixkARkWBnZlcnJvdDESMBAGCgmSJomT8ixkARkWAmZyMIIB
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
6
|
+
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA12mvBkBdLx5lIPvd0hJ6Ccer
|
7
|
+
t5fnF94UNRqE0zTxow9aAAtBb/G4fE/OkOBe69gq/5SSZRgF5m/qQ+//rZHSOUfR
|
8
|
+
f+a1Qqbho0CfFpAurAtDZQS45L5txhz1pRUnz/8bF6nkeKUF0pdLbNNVS9axE3uc
|
9
|
+
qBrfjUAP3yYe3K0TANgZym0TYJ3OhSeUV5Y8tuncuILHZI1hShYekjbPk3KLBJG5
|
10
|
+
16x3sHS209Y5LbRbzs85+HNBcNaN/Yi42IFl+mgdfyQLmbgSTpMtASPCXfsnAxsl
|
11
|
+
6QIiN9pQq9GSvCXA5wH+ZqYtFd6fJqDHVCDAlQ6lYBiCCpC/JV+lZj16c4yDnwID
|
12
|
+
AQABo3MwcTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU7Ygnr1Sx
|
13
|
+
42iryVPwtuJC/acw2TAwGwYDVR0RBBQwEoEQZnJhbmNrQHZlcnJvdC5mcjAbBgNV
|
14
|
+
HRIEFDASgRBmcmFuY2tAdmVycm90LmZyMA0GCSqGSIb3DQEBBQUAA4IBAQBdZVhZ
|
15
|
+
dhXujOsiysxAqtixFFXH9wSQNIltYQ8zuRLA/FgwqrNUQq+Qdiib5Kqj5hUK4okl
|
16
|
+
rTx4uCkHJszIocIZiKE/Ntk6xooQVTC/L95K/yycDCyss2c8JF2wdg/+q38u7rOS
|
17
|
+
fAbV2IGNLTPYWX+M2B08a6lVVRMD386TGrk0/ROjgZIhuHah4dY+ObAUyUv1oiyb
|
18
|
+
PEaDVSbqqbtwQAsY87Vam7GUcH/IJnhdLadvNOJlLr8jxW+gm1ZFE9MOlsSmHeGe
|
19
|
+
Z7BoH/Mfxw3P4yyir173p9JWvVqLiQE13XBeD13NPA8neoWpLJxm6k03PcTElT/E
|
20
|
+
QrOSgKrHAb/fFJma
|
21
21
|
-----END CERTIFICATE-----
|
@@ -0,0 +1 @@
|
|
1
|
+
4c0f3405a0753a3073713c7dd241980f4157d2bc442ce559a8bb5f0fb6b5749eccdfaf56e9eb470a50a2064d4dc6623c9a2eb7378343c0039b27fea97bf96dc5
|
@@ -7,21 +7,21 @@ module ActiveModel
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def validate_each(record, attribute, value)
|
10
|
-
begin
|
11
|
-
|
10
|
+
valid = begin
|
11
|
+
mail = Mail::Address.new(value)
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
basic_check(mail) && value.include?(mail.address)
|
14
|
+
rescue Exception => _
|
15
|
+
false
|
16
|
+
end
|
17
17
|
|
18
18
|
if options[:with]
|
19
|
-
# technically the test suite will pass without the boolean coercion
|
19
|
+
# technically the test suite will pass without the boolean coercion
|
20
20
|
# but we know the code is safer with it in place
|
21
21
|
valid &&= !!options[:with].call(mail)
|
22
22
|
end
|
23
23
|
|
24
|
-
record.errors.add attribute, (options
|
24
|
+
record.errors.add attribute, (options.fetch(:message, :invalid)) unless valid
|
25
25
|
end
|
26
26
|
|
27
27
|
def basic_check(mail)
|
@@ -4,10 +4,22 @@ module ActiveModel
|
|
4
4
|
module Validations
|
5
5
|
class PhoneValidator < EachValidator
|
6
6
|
def validate_each(record, attribute, value)
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
plausible = case (country = options[:country])
|
8
|
+
when ->(s) { s.blank? }
|
9
|
+
# Without a country, try to figure out if it sounds like
|
10
|
+
# a plausible phone number.
|
11
|
+
Phony.plausible?(value)
|
12
|
+
else
|
13
|
+
# In the presence of the country option, provide Phony the country
|
14
|
+
# code associated with it.
|
15
|
+
country_code = ISO3166::Country.new(country.to_s.upcase).country_code
|
16
|
+
Phony.plausible?(value, :cc => country_code)
|
17
|
+
end
|
10
18
|
|
19
|
+
if !plausible
|
20
|
+
record.errors.add(attribute, :invalid)
|
21
|
+
end
|
22
|
+
end
|
11
23
|
end
|
12
24
|
end
|
13
25
|
end
|
@@ -11,7 +11,6 @@ module ActiveModel
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
@formats = PostalCodeValidator.known_formats[country.to_s.downcase]
|
14
|
-
raise "No known postal code formats for country #{country}" unless @formats
|
15
14
|
record.errors.add(attribute) if value.blank? || !matches_any?
|
16
15
|
end
|
17
16
|
|
@@ -34,6 +33,7 @@ module ActiveModel
|
|
34
33
|
'fi' => ['#####'],
|
35
34
|
'fr' => ['#####'],
|
36
35
|
'uk' => ['@# #@@', '@## #@@', '@@# #@@', '@@## #@@', '@#@ #@@', '@@#@ #@@'],
|
36
|
+
'gb' => ['@# #@@', '@## #@@', '@@# #@@', '@@## #@@', '@#@ #@@', '@@#@ #@@'],
|
37
37
|
'gf' => ['#####'],
|
38
38
|
'gl' => ['####'],
|
39
39
|
'gp' => ['#####'],
|
@@ -57,6 +57,7 @@ module ActiveModel
|
|
57
57
|
'my' => ['#####'],
|
58
58
|
'nl' => ['#### @@', '####@@'],
|
59
59
|
'no' => ['####'],
|
60
|
+
'nz' => ['####'],
|
60
61
|
'ph' => ['####'],
|
61
62
|
'pk' => ['#####'],
|
62
63
|
'pl' => ['##-###', '#####'],
|
@@ -64,6 +65,7 @@ module ActiveModel
|
|
64
65
|
'pt' => ['####', '####-###'],
|
65
66
|
'ru' => ['######'],
|
66
67
|
'se' => ['SE-#### ##', '#### ##', '######'],
|
68
|
+
'sg' => ['######'],
|
67
69
|
'si' => ['SI- ####', 'SI-####', '####'],
|
68
70
|
'sk' => ['### ##', '#####'],
|
69
71
|
'sm' => ['4789#', '#'],
|
@@ -76,7 +78,7 @@ module ActiveModel
|
|
76
78
|
end
|
77
79
|
|
78
80
|
def matches_any?
|
79
|
-
|
81
|
+
return true if @formats.nil? or not @formats.respond_to?(:detect)
|
80
82
|
@formats.detect { |format| @value.match(PostalCodeValidator.regexp_from format) }
|
81
83
|
end
|
82
84
|
|
@@ -3,7 +3,7 @@ module ActiveModel
|
|
3
3
|
class SlugValidator < EachValidator
|
4
4
|
def validate_each(record, attribute, value)
|
5
5
|
if value.nil?
|
6
|
-
record.errors.
|
6
|
+
record.errors.add(attribute, :blank)
|
7
7
|
elsif value != value.parameterize
|
8
8
|
record.errors.add(attribute)
|
9
9
|
end
|
@@ -10,7 +10,7 @@ module ActiveModel
|
|
10
10
|
class SsnValidatorGeneral
|
11
11
|
def self.valid?(options, value)
|
12
12
|
if options[:type] == :usa_ssn
|
13
|
-
warn "
|
13
|
+
ActiveSupport::Deprecation.warn "providing {:type => :usa_ssn} is deprecated and will be removed in the future. Please use `:ssn => true` instead."
|
14
14
|
end
|
15
15
|
|
16
16
|
SsnValidatorUSA.new(value).valid?
|
@@ -19,7 +19,7 @@ module ActiveModel
|
|
19
19
|
format = options[:format].to_sym if options[:format]
|
20
20
|
|
21
21
|
if value.nil?
|
22
|
-
record.errors.
|
22
|
+
record.errors.add(attribute, :blank)
|
23
23
|
elsif format == :url
|
24
24
|
match = value.match(TWITTER_URL_REGEXP)
|
25
25
|
record.errors.add(attribute) unless match && !match[1].nil?
|
data/test/test_helper.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
gem 'minitest'
|
2
2
|
require 'minitest/autorun'
|
3
3
|
require 'minitest/mock'
|
4
|
+
require 'active_support/test_case'
|
4
5
|
|
5
6
|
# silence warnings
|
6
7
|
old_w, $-w = $-w, false
|
@@ -21,3 +22,7 @@ class TestRecord
|
|
21
22
|
attrs.each_pair { |k,v| send("#{k}=", v) }
|
22
23
|
end
|
23
24
|
end
|
25
|
+
|
26
|
+
class Minitest::Spec
|
27
|
+
include ActiveSupport::Testing::Deprecation
|
28
|
+
end
|
@@ -7,8 +7,6 @@ describe "Credit Card Validation" do
|
|
7
7
|
{
|
8
8
|
#American Express
|
9
9
|
:amex => '3400 0000 0000 009',
|
10
|
-
#Carte Blanche
|
11
|
-
:carte_blanche => '3800 0000 0000 06',
|
12
10
|
#Discover
|
13
11
|
:discover => '6011 0000 0000 0004',
|
14
12
|
#Diners Club
|
@@ -25,8 +23,6 @@ describe "Credit Card Validation" do
|
|
25
23
|
:maestro => '6759 6498 2643 8453',
|
26
24
|
#Visa
|
27
25
|
:visa => '4111 1111 1111 1111',
|
28
|
-
#Laser
|
29
|
-
:laser => '6304 1000 0000 0008'
|
30
26
|
}
|
31
27
|
|
32
28
|
VALID_CARDS.each_pair do |card, number|
|
@@ -46,6 +42,18 @@ describe "Credit Card Validation" do
|
|
46
42
|
end
|
47
43
|
end
|
48
44
|
|
45
|
+
describe "carte blanche" do
|
46
|
+
it "is deprecated" do
|
47
|
+
subject = build_card_record(
|
48
|
+
{ card: '3800 0000 0000 06' },
|
49
|
+
{ type: :carte_blanche },
|
50
|
+
)
|
51
|
+
assert_deprecated do
|
52
|
+
card_is_valid?(subject)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
49
57
|
describe "using multiple card types" do
|
50
58
|
it "accepts card if one of type valid" do
|
51
59
|
subject = build_card_record({:card => VALID_CARDS[:amex]}, {:type => [:visa, :master_card, :amex]})
|
@@ -102,9 +102,11 @@ describe "Email Validation" do
|
|
102
102
|
end
|
103
103
|
|
104
104
|
it 'generates an error message of type invalid' do
|
105
|
-
subject = build_email_record :email => 'franck
|
105
|
+
subject = build_email_record :email => 'franck@verrot@fr'
|
106
106
|
subject.valid?.must_equal false
|
107
|
-
|
107
|
+
|
108
|
+
message = subject.errors.generate_message(:email, :invalid)
|
109
|
+
subject.errors[:email].include?(message).must_equal true
|
108
110
|
end
|
109
111
|
end
|
110
112
|
|
@@ -8,6 +8,19 @@ describe "Phone Validation" do
|
|
8
8
|
TestRecord.new attrs
|
9
9
|
end
|
10
10
|
|
11
|
+
describe "when a country is given" do
|
12
|
+
it "allows numbers matching that country" do
|
13
|
+
subject = build_phone_validation(country: :gb)
|
14
|
+
subject.phone = '+441234567890'
|
15
|
+
subject.valid?.must_equal true
|
16
|
+
end
|
17
|
+
|
18
|
+
it "does not allow numbers from other countries" do
|
19
|
+
subject = build_phone_validation(country: :gb)
|
20
|
+
subject.phone = '+19999999999'
|
21
|
+
subject.valid?.must_equal false
|
22
|
+
end
|
23
|
+
end
|
11
24
|
|
12
25
|
describe "when no country is given" do
|
13
26
|
it 'should validate format of phone with ###-###-####' do
|
@@ -60,7 +73,9 @@ describe "Phone Validation" do
|
|
60
73
|
subject = build_phone_validation true
|
61
74
|
subject.phone = '999'
|
62
75
|
subject.valid?.must_equal false
|
63
|
-
|
76
|
+
|
77
|
+
message = subject.errors.generate_message(:phone, :invalid)
|
78
|
+
subject.errors[:phone].include?(message).must_equal true
|
64
79
|
end
|
65
80
|
end
|
66
81
|
end
|
@@ -44,6 +44,15 @@ describe "Postal Code Validation" do
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
+
describe "for a country without known formats" do
|
48
|
+
it "accepts anything" do
|
49
|
+
# aa is not in ActiveModel::Validations::PostalCodeValidator.known_formats
|
50
|
+
subject = build_postal_code_record :country => 'aa'
|
51
|
+
subject.postal_code = '999'
|
52
|
+
subject.valid?.must_equal true
|
53
|
+
subject.errors.size.must_equal 0
|
54
|
+
end
|
55
|
+
end
|
47
56
|
|
48
57
|
describe "for invalid formats" do
|
49
58
|
it "rejects invalid formats" do
|
@@ -50,9 +50,11 @@ describe "SSN validations" do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
describe "for valid" do
|
53
|
-
it "
|
54
|
-
|
55
|
-
|
53
|
+
it "supports deprecated usa_ssn syntax" do
|
54
|
+
assert_deprecated do
|
55
|
+
subject = build_ssn_record({:ssn => '444556666'}, {:type => :usa_ssn})
|
56
|
+
subject.valid?.must_equal true
|
57
|
+
end
|
56
58
|
end
|
57
59
|
|
58
60
|
it "accept ssn without type (and use by default 'usa_ssn')" do
|
@@ -18,7 +18,9 @@ describe "Twitter Validation" do
|
|
18
18
|
it "generates an error message of type blank" do
|
19
19
|
subject = build_twitter_record true
|
20
20
|
subject.valid?.must_equal false
|
21
|
-
|
21
|
+
|
22
|
+
message = subject.errors.generate_message(:twitter_username, :blank)
|
23
|
+
subject.errors[:twitter_username].include?(message).must_equal true
|
22
24
|
end
|
23
25
|
|
24
26
|
describe "for twitter url validator" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activevalidators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franck Verrot
|
@@ -18,25 +18,25 @@ cert_chain:
|
|
18
18
|
-----BEGIN CERTIFICATE-----
|
19
19
|
MIIDaDCCAlCgAwIBAgIBATANBgkqhkiG9w0BAQUFADA9MQ8wDQYDVQQDDAZmcmFu
|
20
20
|
Y2sxFjAUBgoJkiaJk/IsZAEZFgZ2ZXJyb3QxEjAQBgoJkiaJk/IsZAEZFgJmcjAe
|
21
|
-
|
21
|
+
Fw0xNjA1MTMxOTQ3NTlaFw0xNzA1MTMxOTQ3NTlaMD0xDzANBgNVBAMMBmZyYW5j
|
22
22
|
azEWMBQGCgmSJomT8ixkARkWBnZlcnJvdDESMBAGCgmSJomT8ixkARkWAmZyMIIB
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
23
|
+
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA12mvBkBdLx5lIPvd0hJ6Ccer
|
24
|
+
t5fnF94UNRqE0zTxow9aAAtBb/G4fE/OkOBe69gq/5SSZRgF5m/qQ+//rZHSOUfR
|
25
|
+
f+a1Qqbho0CfFpAurAtDZQS45L5txhz1pRUnz/8bF6nkeKUF0pdLbNNVS9axE3uc
|
26
|
+
qBrfjUAP3yYe3K0TANgZym0TYJ3OhSeUV5Y8tuncuILHZI1hShYekjbPk3KLBJG5
|
27
|
+
16x3sHS209Y5LbRbzs85+HNBcNaN/Yi42IFl+mgdfyQLmbgSTpMtASPCXfsnAxsl
|
28
|
+
6QIiN9pQq9GSvCXA5wH+ZqYtFd6fJqDHVCDAlQ6lYBiCCpC/JV+lZj16c4yDnwID
|
29
|
+
AQABo3MwcTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU7Ygnr1Sx
|
30
|
+
42iryVPwtuJC/acw2TAwGwYDVR0RBBQwEoEQZnJhbmNrQHZlcnJvdC5mcjAbBgNV
|
31
|
+
HRIEFDASgRBmcmFuY2tAdmVycm90LmZyMA0GCSqGSIb3DQEBBQUAA4IBAQBdZVhZ
|
32
|
+
dhXujOsiysxAqtixFFXH9wSQNIltYQ8zuRLA/FgwqrNUQq+Qdiib5Kqj5hUK4okl
|
33
|
+
rTx4uCkHJszIocIZiKE/Ntk6xooQVTC/L95K/yycDCyss2c8JF2wdg/+q38u7rOS
|
34
|
+
fAbV2IGNLTPYWX+M2B08a6lVVRMD386TGrk0/ROjgZIhuHah4dY+ObAUyUv1oiyb
|
35
|
+
PEaDVSbqqbtwQAsY87Vam7GUcH/IJnhdLadvNOJlLr8jxW+gm1ZFE9MOlsSmHeGe
|
36
|
+
Z7BoH/Mfxw3P4yyir173p9JWvVqLiQE13XBeD13NPA8neoWpLJxm6k03PcTElT/E
|
37
|
+
QrOSgKrHAb/fFJma
|
38
38
|
-----END CERTIFICATE-----
|
39
|
-
date:
|
39
|
+
date: 2016-07-16 00:00:00.000000000 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
@@ -56,114 +56,114 @@ dependencies:
|
|
56
56
|
name: minitest
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0
|
75
|
+
version: '0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: mail
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: '0'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: date_validator
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: '0'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: activemodel
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0
|
117
|
+
version: '3.0'
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0
|
124
|
+
version: '3.0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: phony
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
131
|
+
version: '2.0'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - "
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
138
|
+
version: '2.0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
140
|
+
name: countries
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - "
|
143
|
+
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '
|
145
|
+
version: '1.2'
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - "
|
150
|
+
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: '
|
152
|
+
version: '1.2'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: credit_card_validations
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
159
|
+
version: '3.2'
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
166
|
+
version: '3.2'
|
167
167
|
description: ActiveValidators is a collection of ActiveModel/ActiveRecord validations
|
168
168
|
email:
|
169
169
|
- franck@verrot.fr
|
@@ -182,6 +182,7 @@ files:
|
|
182
182
|
- certs/franckverrot.pem
|
183
183
|
- checksums/3.1.2.sha512
|
184
184
|
- checksums/3.2.0.sha512
|
185
|
+
- checksums/4.0.0.sha512
|
185
186
|
- lib/active_validators/active_model/validations/barcode_validator.rb
|
186
187
|
- lib/active_validators/active_model/validations/credit_card_validator.rb
|
187
188
|
- lib/active_validators/active_model/validations/date_validator.rb
|
@@ -236,7 +237,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
236
237
|
requirements:
|
237
238
|
- - ">="
|
238
239
|
- !ruby/object:Gem::Version
|
239
|
-
version:
|
240
|
+
version: 2.2.2
|
240
241
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
241
242
|
requirements:
|
242
243
|
- - ">="
|
@@ -269,4 +270,3 @@ test_files:
|
|
269
270
|
- test/validations/tracking_number_test.rb
|
270
271
|
- test/validations/twitter_test.rb
|
271
272
|
- test/validations/url_test.rb
|
272
|
-
has_rdoc:
|
metadata.gz.sig
CHANGED
Binary file
|