mask_validator 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +0 -1
- data/.travis.yml +5 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +55 -0
- data/README.markdown +26 -14
- data/Rakefile +7 -0
- data/changelog.md +7 -0
- data/lib/mask_validator.rb +12 -2
- data/mask_validator.gemspec +1 -1
- data/spec/mask_validator_spec.rb +172 -159
- data/spec/spec_helper.rb +3 -2
- data/spec/support/models/no_active_record_person.rb +7 -0
- metadata +35 -24
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4ec0a58857f3b750976639d4ccda2754bcf206b4
|
4
|
+
data.tar.gz: 846416f9ca4910ec2711f25453b484b8a4325e2e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 19e048a911fef5c795cc095cf5d2671b765fcd2dec7a68042b68951b7b952405d2987ca7cf47d31c9eeddedad88bfacd57ab7679a389e98e364a5d00fc8011a4
|
7
|
+
data.tar.gz: 7dc0f0d78e199420c5e75bf5833d0697be55f22ff7666c9827392e85e6cb33b15e64ad6568f4601e4f1a8ba36e73cdb37384487f8f10666fc52e52185e4eb011
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
mask_validator (0.2.1)
|
5
|
+
activemodel (>= 3.0)
|
6
|
+
activerecord (>= 3.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activemodel (4.2.0)
|
12
|
+
activesupport (= 4.2.0)
|
13
|
+
builder (~> 3.1)
|
14
|
+
activerecord (4.2.0)
|
15
|
+
activemodel (= 4.2.0)
|
16
|
+
activesupport (= 4.2.0)
|
17
|
+
arel (~> 6.0)
|
18
|
+
activesupport (4.2.0)
|
19
|
+
i18n (~> 0.7)
|
20
|
+
json (~> 1.7, >= 1.7.7)
|
21
|
+
minitest (~> 5.1)
|
22
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
23
|
+
tzinfo (~> 1.1)
|
24
|
+
arel (6.0.0)
|
25
|
+
builder (3.2.2)
|
26
|
+
diff-lcs (1.2.5)
|
27
|
+
i18n (0.7.0)
|
28
|
+
json (1.8.1)
|
29
|
+
minitest (5.5.0)
|
30
|
+
rake (10.4.2)
|
31
|
+
rspec (3.1.0)
|
32
|
+
rspec-core (~> 3.1.0)
|
33
|
+
rspec-expectations (~> 3.1.0)
|
34
|
+
rspec-mocks (~> 3.1.0)
|
35
|
+
rspec-core (3.1.7)
|
36
|
+
rspec-support (~> 3.1.0)
|
37
|
+
rspec-expectations (3.1.2)
|
38
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
39
|
+
rspec-support (~> 3.1.0)
|
40
|
+
rspec-mocks (3.1.3)
|
41
|
+
rspec-support (~> 3.1.0)
|
42
|
+
rspec-support (3.1.2)
|
43
|
+
sqlite3 (1.3.10)
|
44
|
+
thread_safe (0.3.4)
|
45
|
+
tzinfo (1.2.2)
|
46
|
+
thread_safe (~> 0.1)
|
47
|
+
|
48
|
+
PLATFORMS
|
49
|
+
ruby
|
50
|
+
|
51
|
+
DEPENDENCIES
|
52
|
+
mask_validator!
|
53
|
+
rake
|
54
|
+
rspec
|
55
|
+
sqlite3
|
data/README.markdown
CHANGED
@@ -1,33 +1,45 @@
|
|
1
|
-
#
|
1
|
+
# Mask Validator
|
2
2
|
|
3
|
-
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/mask_validator.png)](http://badge.fury.io/rb/mask_validator)
|
4
4
|
|
5
|
-
|
5
|
+
This gem was inspired in the Sobrinho's gems to validate simple things inside of ActiveModel.
|
6
6
|
|
7
|
-
The gem works getting the value before type cast and comparing with a
|
7
|
+
The gem works getting the value before type cast and comparing with a regular expression from the parse of mask pattern.
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
11
|
-
|
11
|
+
Put `gem "mask_validator", "0.2.1"` in the Gemfile
|
12
12
|
|
13
|
-
|
13
|
+
## Usage
|
14
14
|
|
15
|
-
|
15
|
+
```ruby
|
16
|
+
validates :phone, :mask => "(99) 9999-9999"
|
16
17
|
|
17
|
-
|
18
|
+
validates :acronym, :mask => "***"
|
18
19
|
|
19
|
-
|
20
|
+
validates :acronym, :mask => :custom_method
|
20
21
|
|
21
|
-
|
22
|
+
validates :acronym, :mask => Proc.new { |o| o.custom_method }
|
23
|
+
```
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
-
* a - Represents an alpha character (A-Z,a-z)
|
25
|
+
* a - Represents an alpha character (A-Z, a-z)
|
26
26
|
* 9 - Represents a numeric character (0-9)
|
27
|
-
* * - Represents an alphanumeric character (A-Z,a-z,0-9)
|
27
|
+
* * - Represents an alphanumeric character (A-Z, a-z, 0-9)
|
28
28
|
|
29
29
|
For more information about masks in the form inputs check the jquery plugin [Masked input](http://digitalbush.com/projects/masked-input-plugin/)
|
30
30
|
|
31
|
+
## Application example
|
32
|
+
|
33
|
+
Use a little trick to call the masked input (jquery plugin) only defining the validation in the model.
|
34
|
+
|
35
|
+
In other words, defining:
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
validates :phone, :mask => "(99) 9999-9999"
|
39
|
+
```
|
40
|
+
|
41
|
+
It is the only necessary thing to apply the masked input.
|
42
|
+
|
31
43
|
## License
|
32
44
|
|
33
45
|
Copyright © 2011 Marcelo Cajueiro, released under the MIT license
|
data/Rakefile
CHANGED
data/changelog.md
ADDED
data/lib/mask_validator.rb
CHANGED
@@ -20,7 +20,7 @@ class MaskValidator < ActiveModel::EachValidator
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def validate_each(record, attribute, value)
|
23
|
-
value = record
|
23
|
+
value = normalize_value(record, attribute, value)
|
24
24
|
|
25
25
|
return if (@allow_nil && value.nil?) || (@allow_blank && value.blank?)
|
26
26
|
|
@@ -65,6 +65,16 @@ class MaskValidator < ActiveModel::EachValidator
|
|
65
65
|
private
|
66
66
|
|
67
67
|
def message
|
68
|
-
options[:message]
|
68
|
+
options[:message] || :invalid
|
69
|
+
end
|
70
|
+
|
71
|
+
def normalize_value(record, attribute, value)
|
72
|
+
attribute_before_type_cast = "#{attribute.to_s}_before_type_cast"
|
73
|
+
|
74
|
+
if record.respond_to?(attribute_before_type_cast)
|
75
|
+
value = record.send(attribute_before_type_cast)
|
76
|
+
end
|
77
|
+
|
78
|
+
value
|
69
79
|
end
|
70
80
|
end
|
data/mask_validator.gemspec
CHANGED
data/spec/mask_validator_spec.rb
CHANGED
@@ -1,187 +1,200 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe MaskValidator do
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
context 'When class is not an ActiveRecord model' do
|
5
|
+
subject do
|
6
|
+
NoActiveRecordPerson.new
|
7
|
+
end
|
7
8
|
|
8
|
-
# validates :phone, :mask => "(99) 9999-9999", :allow_blank => true
|
9
|
-
context "mask validation to phone" do
|
10
9
|
it "should be valid with a phone in according of the mask" do
|
11
10
|
subject.phone = '(48) 9874-4569'
|
12
|
-
subject.
|
13
|
-
end
|
14
|
-
|
15
|
-
it "should not be valid with a phone with a wrong pattern" do
|
16
|
-
subject.phone = '4852458787'
|
17
|
-
subject.should_not have_valid_value_to(:phone)
|
18
|
-
|
19
|
-
subject.phone = '48 9865 4879'
|
20
|
-
subject.should_not have_valid_value_to(:phone)
|
21
|
-
|
22
|
-
subject.phone = '(48) 9874-45169'
|
23
|
-
subject.should_not have_valid_value_to(:phone)
|
24
|
-
|
25
|
-
subject.phone = '(48)98956698'
|
26
|
-
subject.should_not have_valid_value_to(:phone)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
# validates :acronym, :mask => "***", :allow_nil => true
|
31
|
-
context "mask validation to acronym" do
|
32
|
-
it "should be valid with a acronym in according of the mask" do
|
33
|
-
subject.acronym = '1gd'
|
34
|
-
subject.should have_valid_value_to(:acronym)
|
35
|
-
|
36
|
-
subject.acronym = '666'
|
37
|
-
subject.should have_valid_value_to(:acronym)
|
38
|
-
|
39
|
-
subject.acronym = 'zzz'
|
40
|
-
subject.should have_valid_value_to(:acronym)
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should not be valid with a acronym with a wrong pattern" do
|
44
|
-
subject.acronym = '1qw1'
|
45
|
-
subject.should_not have_valid_value_to(:acronym)
|
11
|
+
expect(subject).to have_valid_value_to(:phone)
|
46
12
|
end
|
47
13
|
end
|
48
14
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
subject.alphanumeric = 'awe987'
|
53
|
-
subject.should have_valid_value_to(:alphanumeric)
|
15
|
+
context 'When class is an ActiveRecord model' do
|
16
|
+
subject do
|
17
|
+
Person.new
|
54
18
|
end
|
55
19
|
|
56
|
-
|
57
|
-
|
58
|
-
|
20
|
+
# validates :phone, :mask => "(99) 9999-9999", :allow_blank => true
|
21
|
+
context "mask validation to phone" do
|
22
|
+
it "should be valid with a phone in according of the mask" do
|
23
|
+
subject.phone = '(48) 9874-4569'
|
24
|
+
expect(subject).to have_valid_value_to(:phone)
|
25
|
+
end
|
59
26
|
|
60
|
-
|
61
|
-
|
27
|
+
it "should not be valid with a phone with a wrong pattern" do
|
28
|
+
subject.phone = '4852458787'
|
29
|
+
expect(subject).to_not have_valid_value_to(:phone)
|
62
30
|
|
63
|
-
|
64
|
-
|
31
|
+
subject.phone = '48 9865 4879'
|
32
|
+
expect(subject).to_not have_valid_value_to(:phone)
|
65
33
|
|
66
|
-
|
67
|
-
|
68
|
-
end
|
69
|
-
end
|
34
|
+
subject.phone = '(48) 9874-45169'
|
35
|
+
expect(subject).to_not have_valid_value_to(:phone)
|
70
36
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
subject.should_not have_valid_value_to(:birth_date)
|
37
|
+
subject.phone = '(48)98956698'
|
38
|
+
expect(subject).to_not have_valid_value_to(:phone)
|
39
|
+
end
|
75
40
|
end
|
76
41
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
42
|
+
# validates :acronym, :mask => "***", :allow_nil => true
|
43
|
+
context "mask validation to acronym" do
|
44
|
+
it "should be valid with a acronym in according of the mask" do
|
45
|
+
subject.acronym = '1gd'
|
46
|
+
expect(subject).to have_valid_value_to(:acronym)
|
81
47
|
|
82
|
-
|
83
|
-
|
84
|
-
subject.should_not have_valid_value_to(:birth_time)
|
85
|
-
end
|
48
|
+
subject.acronym = '666'
|
49
|
+
expect(subject).to have_valid_value_to(:acronym)
|
86
50
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
end
|
91
|
-
end
|
51
|
+
subject.acronym = 'zzz'
|
52
|
+
expect(subject).to have_valid_value_to(:acronym)
|
53
|
+
end
|
92
54
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
subject.custom = '32632-567'
|
98
|
-
subject.should have_valid_value_to(:custom)
|
55
|
+
it "should not be valid with a acronym with a wrong pattern" do
|
56
|
+
subject.acronym = '1qw1'
|
57
|
+
expect(subject).to_not have_valid_value_to(:acronym)
|
58
|
+
end
|
99
59
|
end
|
100
60
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
61
|
+
# validates :alphanumeric, :mask => "aaa999"
|
62
|
+
context "mask validation to alphanumeric" do
|
63
|
+
it "should be valid with a alphanumeric in according of the mask" do
|
64
|
+
subject.alphanumeric = 'awe987'
|
65
|
+
expect(subject).to have_valid_value_to(:alphanumeric)
|
66
|
+
end
|
107
67
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
end
|
68
|
+
it "should not be valid with a alphanumeric with a wrong pattern" do
|
69
|
+
subject.alphanumeric = '999999'
|
70
|
+
expect(subject).to_not have_valid_value_to(:alphanumeric)
|
71
|
+
|
72
|
+
subject.alphanumeric = 'QQQQQQ'
|
73
|
+
expect(subject).to_not have_valid_value_to(:alphanumeric)
|
115
74
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
it "should be valid with an empty phone" do
|
131
|
-
subject.phone = ''
|
132
|
-
subject.should have_valid_value_to(:phone)
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
# validates :acronym, :mask => "***", :allow_nil => true
|
137
|
-
context "mask validation to acronym with explicit ':allow_nil => true'" do
|
138
|
-
it "should be valid with an nil acronym" do
|
139
|
-
subject.acronym = nil
|
140
|
-
subject.should have_valid_value_to(:acronym)
|
141
|
-
end
|
142
|
-
|
143
|
-
it "should be valid with an empty acronym" do
|
144
|
-
subject.acronym = ''
|
145
|
-
subject.should_not have_valid_value_to(:acronym)
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
# validates :fax, :mask => "(99) 9999-9999", :allow_nil => false
|
150
|
-
context "mask validation to fax with explicit ':allow_nil => false'" do
|
151
|
-
it "should not be valid with an nil fax" do
|
152
|
-
subject.fax = nil
|
153
|
-
subject.should_not have_valid_value_to(:fax)
|
154
|
-
end
|
155
|
-
|
156
|
-
it "should be valid with an empty fax" do
|
157
|
-
subject.fax = ''
|
158
|
-
subject.should_not have_valid_value_to(:fax)
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
# validates :zip_code, :mask => "99999-999", :allow_blank => false
|
163
|
-
context "mask validation to zip_code with explicit ':allow_blank => false'" do
|
164
|
-
it "should not be valid with an nil zip_code" do
|
165
|
-
subject.zip_code = nil
|
166
|
-
subject.should_not have_valid_value_to(:zip_code)
|
167
|
-
end
|
168
|
-
|
169
|
-
it "should be valid with an empty zip_code" do
|
170
|
-
subject.zip_code = ''
|
171
|
-
subject.should_not have_valid_value_to(:zip_code)
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
# validates :birth_date, :mask => '99/99/9999'
|
176
|
-
context "mask validation to birth_date with implicit ':allow_blank => false'" do
|
177
|
-
it "should not be valid with an nil birth_date" do
|
178
|
-
subject.birth_date = nil
|
179
|
-
subject.should_not have_valid_value_to(:birth_date)
|
180
|
-
end
|
75
|
+
subject.alphanumeric = '666aaaa'
|
76
|
+
expect(subject).to_not have_valid_value_to(:alphanumeric)
|
77
|
+
|
78
|
+
subject.alphanumeric = '666AAA'
|
79
|
+
expect(subject).to_not have_valid_value_to(:alphanumeric)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
context "when the attributes type is not a string" do
|
84
|
+
it "should not be valid with a wrong date format" do
|
85
|
+
subject.birth_date = "15-12-2009"
|
86
|
+
expect(subject).to_not have_valid_value_to(:birth_date)
|
87
|
+
end
|
181
88
|
|
182
|
-
|
183
|
-
|
184
|
-
|
89
|
+
it "should not be valid with a wrong birth year" do
|
90
|
+
subject.birth_year = 20110
|
91
|
+
expect(subject).to_not have_valid_value_to(:birth_year)
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should not be valid with a wrong birth time" do
|
95
|
+
subject.birth_time = "333:20"
|
96
|
+
expect(subject).to_not have_valid_value_to(:birth_time)
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should not be valid with a wrong body fat" do
|
100
|
+
subject.body_fat = 333.00
|
101
|
+
expect(subject).to_not have_valid_value_to(:body_fat)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
# validates :custom, :mask => :custom_mask, :allow_blank => false
|
106
|
+
context "mask validation to custom field using custom_mask method" do
|
107
|
+
it "should be valid with an correct custom value" do
|
108
|
+
allow(subject).to receive(:custom_mask).and_return("99999-999")
|
109
|
+
subject.custom = '32632-567'
|
110
|
+
expect(subject).to have_valid_value_to(:custom)
|
111
|
+
end
|
112
|
+
|
113
|
+
it "should not be valid with an empty custom value" do
|
114
|
+
allow(subject).to receive(:custom_mask).and_return("9.9.9")
|
115
|
+
subject.custom = ''
|
116
|
+
expect(subject).to_not have_valid_value_to(:custom)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
# validates :identification, :mask => Proc.new{|o| o.proc_mask}, :allow_blank => false
|
121
|
+
context "mask validation to proc field using a Proc" do
|
122
|
+
it "should be valid with an correct value" do
|
123
|
+
allow(subject).to receive(:proc_mask).and_return("999.9.99")
|
124
|
+
subject.identification = '326.3.67'
|
125
|
+
expect(subject).to have_valid_value_to(:identification)
|
126
|
+
end
|
127
|
+
|
128
|
+
it "should not be valid with an empty value" do
|
129
|
+
allow(subject).to receive(:proc_mask).and_return("9.9.9")
|
130
|
+
subject.identification = ''
|
131
|
+
expect(subject).to_not have_valid_value_to(:identification)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
# validates :phone, :mask => "99999-999", :allow_blank => true
|
136
|
+
context "mask validation to phone with explicit ':allow_blank => true'" do
|
137
|
+
it "should not be valid with an nil phone" do
|
138
|
+
subject.phone = nil
|
139
|
+
expect(subject).to have_valid_value_to(:phone)
|
140
|
+
end
|
141
|
+
|
142
|
+
it "should be valid with an empty phone" do
|
143
|
+
subject.phone = ''
|
144
|
+
expect(subject).to have_valid_value_to(:phone)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
# validates :acronym, :mask => "***", :allow_nil => true
|
149
|
+
context "mask validation to acronym with explicit ':allow_nil => true'" do
|
150
|
+
it "should be valid with an nil acronym" do
|
151
|
+
subject.acronym = nil
|
152
|
+
expect(subject).to have_valid_value_to(:acronym)
|
153
|
+
end
|
154
|
+
|
155
|
+
it "should be valid with an empty acronym" do
|
156
|
+
subject.acronym = ''
|
157
|
+
expect(subject).to_not have_valid_value_to(:acronym)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
# validates :fax, :mask => "(99) 9999-9999", :allow_nil => false
|
162
|
+
context "mask validation to fax with explicit ':allow_nil => false'" do
|
163
|
+
it "should not be valid with an nil fax" do
|
164
|
+
subject.fax = nil
|
165
|
+
expect(subject).to_not have_valid_value_to(:fax)
|
166
|
+
end
|
167
|
+
|
168
|
+
it "should be valid with an empty fax" do
|
169
|
+
subject.fax = ''
|
170
|
+
expect(subject).to_not have_valid_value_to(:fax)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
# validates :zip_code, :mask => "99999-999", :allow_blank => false
|
175
|
+
context "mask validation to zip_code with explicit ':allow_blank => false'" do
|
176
|
+
it "should not be valid with an nil zip_code" do
|
177
|
+
subject.zip_code = nil
|
178
|
+
expect(subject).to_not have_valid_value_to(:zip_code)
|
179
|
+
end
|
180
|
+
|
181
|
+
it "should be valid with an empty zip_code" do
|
182
|
+
subject.zip_code = ''
|
183
|
+
expect(subject).to_not have_valid_value_to(:zip_code)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
# validates :birth_date, :mask => '99/99/9999'
|
188
|
+
context "mask validation to birth_date with implicit ':allow_blank => false'" do
|
189
|
+
it "should not be valid with an nil birth_date" do
|
190
|
+
subject.birth_date = nil
|
191
|
+
expect(subject).to_not have_valid_value_to(:birth_date)
|
192
|
+
end
|
193
|
+
|
194
|
+
it "should be valid with an empty birth_date" do
|
195
|
+
subject.birth_date = ''
|
196
|
+
expect(subject).to_not have_valid_value_to(:birth_date)
|
197
|
+
end
|
185
198
|
end
|
186
199
|
end
|
187
200
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -5,6 +5,7 @@ require 'mask_validator'
|
|
5
5
|
|
6
6
|
require "support/db/schema"
|
7
7
|
require "support/models/person"
|
8
|
+
require "support/models/no_active_record_person"
|
8
9
|
|
9
10
|
RSpec::Matchers.define :have_valid_value_to do |attribute|
|
10
11
|
match do |actual|
|
@@ -13,11 +14,11 @@ RSpec::Matchers.define :have_valid_value_to do |attribute|
|
|
13
14
|
!actual.errors[attribute].include?("is invalid")
|
14
15
|
end
|
15
16
|
|
16
|
-
|
17
|
+
failure_message do |actual|
|
17
18
|
"expected that the #{attribute} attribute would be valid"
|
18
19
|
end
|
19
20
|
|
20
|
-
|
21
|
+
failure_message_when_negated do |actual|
|
21
22
|
"expected that the #{attribute} attribute would be invalid"
|
22
23
|
end
|
23
24
|
end
|
metadata
CHANGED
@@ -1,49 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mask_validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Marcelo Cajueiro
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-01-08 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activemodel
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '3.0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.0'
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: activerecord
|
27
|
-
requirement:
|
28
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
|
-
- -
|
31
|
+
- - ">="
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: '3.0'
|
33
34
|
type: :runtime
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.0'
|
36
41
|
- !ruby/object:Gem::Dependency
|
37
42
|
name: rake
|
38
|
-
requirement:
|
39
|
-
none: false
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
40
44
|
requirements:
|
41
|
-
- -
|
45
|
+
- - ">="
|
42
46
|
- !ruby/object:Gem::Version
|
43
47
|
version: 0.8.7
|
44
48
|
type: :development
|
45
49
|
prerelease: false
|
46
|
-
version_requirements:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.8.7
|
47
55
|
description:
|
48
56
|
email:
|
49
57
|
- marcelocajueiro@gmail.com
|
@@ -51,47 +59,50 @@ executables: []
|
|
51
59
|
extensions: []
|
52
60
|
extra_rdoc_files: []
|
53
61
|
files:
|
54
|
-
- .gitignore
|
55
|
-
- .rspec
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
56
65
|
- Gemfile
|
66
|
+
- Gemfile.lock
|
57
67
|
- MIT-LICENSE
|
58
68
|
- README.markdown
|
59
69
|
- Rakefile
|
70
|
+
- changelog.md
|
60
71
|
- lib/mask_validator.rb
|
61
72
|
- mask_validator.gemspec
|
62
73
|
- spec/mask_validator_spec.rb
|
63
74
|
- spec/models/person.rb
|
64
75
|
- spec/spec_helper.rb
|
65
76
|
- spec/support/db/schema.rb
|
77
|
+
- spec/support/models/no_active_record_person.rb
|
66
78
|
- spec/support/models/person.rb
|
67
79
|
homepage: https://github.com/marcelocajueiro/mask_validator
|
68
80
|
licenses: []
|
81
|
+
metadata: {}
|
69
82
|
post_install_message:
|
70
83
|
rdoc_options: []
|
71
84
|
require_paths:
|
72
85
|
- lib
|
73
86
|
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
87
|
requirements:
|
76
|
-
- -
|
88
|
+
- - ">="
|
77
89
|
- !ruby/object:Gem::Version
|
78
90
|
version: '0'
|
79
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
-
none: false
|
81
92
|
requirements:
|
82
|
-
- -
|
93
|
+
- - ">="
|
83
94
|
- !ruby/object:Gem::Version
|
84
95
|
version: '0'
|
85
96
|
requirements: []
|
86
97
|
rubyforge_project: mask_validator
|
87
|
-
rubygems_version:
|
98
|
+
rubygems_version: 2.4.4
|
88
99
|
signing_key:
|
89
|
-
specification_version:
|
100
|
+
specification_version: 4
|
90
101
|
summary: Input Mask validation for ActiveModel
|
91
102
|
test_files:
|
92
103
|
- spec/mask_validator_spec.rb
|
93
104
|
- spec/models/person.rb
|
94
105
|
- spec/spec_helper.rb
|
95
106
|
- spec/support/db/schema.rb
|
107
|
+
- spec/support/models/no_active_record_person.rb
|
96
108
|
- spec/support/models/person.rb
|
97
|
-
has_rdoc:
|