activevalidators 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
data/activevalidators.gemspec
CHANGED
@@ -4,7 +4,7 @@ $:.unshift lib unless $:.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "activevalidators"
|
7
|
-
s.version = '1.5.
|
7
|
+
s.version = '1.5.1'
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["Franck Verrot", "Paco Guzmán", "Oriol Gual", "Garrett Bjerkhoel", "Renato Riccieri Santos Zannon", "Brian Moseley"]
|
10
10
|
s.email = ["franck@verrot.fr"]
|
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_dependency 'activemodel' , '~> 3.0.0'
|
21
21
|
s.add_dependency 'mail' , '~> 2.2.15'
|
22
22
|
s.add_dependency 'date_validator', '~> 0.6.1'
|
23
|
+
s.add_dependency 'date_validator', '~> 0.6.1'
|
23
24
|
|
24
25
|
s.files = `git ls-files`.split("\n")
|
25
26
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -13,7 +13,7 @@ module ActiveModel
|
|
13
13
|
def self.known_formats
|
14
14
|
@@known_formats ||= {
|
15
15
|
# see https://www.ups.com/content/us/en/tracking/help/tracking/tnh.html
|
16
|
-
:ups => ['1Z
|
16
|
+
:ups => ['1Z................', '............', 'T..........', '.........'],
|
17
17
|
}
|
18
18
|
end
|
19
19
|
|
@@ -25,7 +25,7 @@ module ActiveModel
|
|
25
25
|
private
|
26
26
|
|
27
27
|
def self.regexp_from(format)
|
28
|
-
Regexp.new "^"+(Regexp.escape format).gsub('\#','\d')+"$"
|
28
|
+
Regexp.new "^"+(Regexp.escape format).gsub('\#','\d').gsub('\.','[a-zA-Z0-9]')+"$"
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -21,26 +21,26 @@ describe "Tracking Number Validation" do
|
|
21
21
|
TestRecord.validates :tracking_number, :tracking_number => {:carrier => :ups}
|
22
22
|
end
|
23
23
|
|
24
|
-
it 'should validate format of tracking number with 1Z
|
25
|
-
subject.tracking_number = '
|
24
|
+
it 'should validate format of tracking number with 1Z................' do
|
25
|
+
subject.tracking_number = '1Z12345E0205271688'
|
26
26
|
subject.should be_valid
|
27
27
|
subject.should have(0).errors
|
28
28
|
end
|
29
29
|
|
30
|
-
it 'should validate format of tracking number with
|
31
|
-
subject.tracking_number = '
|
30
|
+
it 'should validate format of tracking number with ............' do
|
31
|
+
subject.tracking_number = '9999V999J999'
|
32
32
|
subject.should be_valid
|
33
33
|
subject.should have(0).errors
|
34
34
|
end
|
35
35
|
|
36
|
-
it 'should validate format of tracking number with T
|
37
|
-
subject.tracking_number = '
|
36
|
+
it 'should validate format of tracking number with T..........' do
|
37
|
+
subject.tracking_number = 'T99F99E9999'
|
38
38
|
subject.should be_valid
|
39
39
|
subject.should have(0).errors
|
40
40
|
end
|
41
41
|
|
42
|
-
it 'should validate format of tracking number with
|
43
|
-
subject.tracking_number = '
|
42
|
+
it 'should validate format of tracking number with .........' do
|
43
|
+
subject.tracking_number = '990728071'
|
44
44
|
subject.should be_valid
|
45
45
|
subject.should have(0).errors
|
46
46
|
end
|
@@ -50,7 +50,7 @@ describe "Tracking Number Validation" do
|
|
50
50
|
before :each do
|
51
51
|
TestRecord.reset_callbacks(:validate)
|
52
52
|
TestRecord.validates :tracking_number, :tracking_number => {:carrier => :ups}
|
53
|
-
subject.tracking_number = '
|
53
|
+
subject.tracking_number = '1Z12345E020_271688'
|
54
54
|
end
|
55
55
|
|
56
56
|
it "rejects invalid formats" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activevalidators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 1.5.
|
9
|
+
- 1
|
10
|
+
version: 1.5.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Franck Verrot
|
@@ -143,6 +143,22 @@ dependencies:
|
|
143
143
|
version: 0.6.1
|
144
144
|
type: :runtime
|
145
145
|
version_requirements: *id008
|
146
|
+
- !ruby/object:Gem::Dependency
|
147
|
+
name: date_validator
|
148
|
+
prerelease: false
|
149
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
150
|
+
none: false
|
151
|
+
requirements:
|
152
|
+
- - ~>
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
hash: 5
|
155
|
+
segments:
|
156
|
+
- 0
|
157
|
+
- 6
|
158
|
+
- 1
|
159
|
+
version: 0.6.1
|
160
|
+
type: :runtime
|
161
|
+
version_requirements: *id009
|
146
162
|
description: ActiveValidators is a collection of ActiveModel/ActiveRecord validations
|
147
163
|
email:
|
148
164
|
- franck@verrot.fr
|