tram-validators 0.0.1 → 0.0.2
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/CHANGELOG.md +10 -0
- data/lib/tram/validators/size_validator.rb +1 -1
- data/spec/tram-validators/size_validator_spec.rb +24 -24
- data/tram-validators.gemspec +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 051a300329482a3a9e2fb6fd94b0b1524dfa4414
|
4
|
+
data.tar.gz: 1ba098b3f8491e39685344c6b6d3388974cb432b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 010b15497c14c7941109b8f03659736773d61a57096e586a80e118538ac918dee792f1f0e4011afffed89ba1b2926fe61302d7fc388e7cf7705ab21b75390b7d
|
7
|
+
data.tar.gz: 1eb3588d68494cd4a19fa38cac85cddc67e596beff3e76ea5a768b41632253fb3fd79e3b215308dcf1ac1842ae1f3201a2ef4b5ae222a214ea29ad581aff17bc
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# v0.0.2 (2017-01-27)
|
2
|
+
|
3
|
+
## New Features
|
4
|
+
- Apply size validator to every value that respond to `:size` (nepalez)
|
5
|
+
|
6
|
+
[Compare v0.0.1...v0.0.2](https://github.com/tram-rb/tram-validators/compare/v0.0.1...v0.0.2)
|
7
|
+
|
8
|
+
# v0.0.1
|
9
|
+
|
10
|
+
This is the very first public release.
|
@@ -6,7 +6,7 @@
|
|
6
6
|
#
|
7
7
|
class SizeValidator < ActiveModel::EachValidator
|
8
8
|
def validate_each(record, attribute, value)
|
9
|
-
size = value.size if value.
|
9
|
+
size = value.size if value.respond_to? :size
|
10
10
|
Tram::Validators::CONDITIONS.each do |key, block|
|
11
11
|
check(key, record, attribute, size, &block)
|
12
12
|
end
|
@@ -29,8 +29,8 @@ RSpec.describe SizeValidator do
|
|
29
29
|
it { is_expected.to be_invalid_with_error :foo, :size_equal_to }
|
30
30
|
end
|
31
31
|
|
32
|
-
context "when attribute
|
33
|
-
let(:foo) {
|
32
|
+
context "when attribute has no size" do
|
33
|
+
let(:foo) { double }
|
34
34
|
it { is_expected.to be_invalid_with_error :foo, :size_equal_to }
|
35
35
|
end
|
36
36
|
end
|
@@ -53,8 +53,8 @@ RSpec.describe SizeValidator do
|
|
53
53
|
it { is_expected.to be_valid }
|
54
54
|
end
|
55
55
|
|
56
|
-
context "when attribute
|
57
|
-
let(:foo) {
|
56
|
+
context "when attribute has no size" do
|
57
|
+
let(:foo) { double }
|
58
58
|
it { is_expected.to be_invalid_with_error :foo, :size_other_than }
|
59
59
|
end
|
60
60
|
end
|
@@ -77,8 +77,8 @@ RSpec.describe SizeValidator do
|
|
77
77
|
it { is_expected.to be_valid }
|
78
78
|
end
|
79
79
|
|
80
|
-
context "when attribute
|
81
|
-
let(:foo) {
|
80
|
+
context "when attribute has no size" do
|
81
|
+
let(:foo) { double }
|
82
82
|
it { is_expected.to be_invalid_with_error :foo, :size_greater_than }
|
83
83
|
end
|
84
84
|
end
|
@@ -106,8 +106,8 @@ RSpec.describe SizeValidator do
|
|
106
106
|
it { is_expected.to be_valid }
|
107
107
|
end
|
108
108
|
|
109
|
-
context "when attribute
|
110
|
-
let(:foo) {
|
109
|
+
context "when attribute has no size" do
|
110
|
+
let(:foo) { double }
|
111
111
|
it do
|
112
112
|
is_expected
|
113
113
|
.to be_invalid_with_error :foo, :size_greater_than_or_equal_to
|
@@ -133,8 +133,8 @@ RSpec.describe SizeValidator do
|
|
133
133
|
it { is_expected.to be_invalid_with_error :foo, :size_less_than }
|
134
134
|
end
|
135
135
|
|
136
|
-
context "when attribute
|
137
|
-
let(:foo) {
|
136
|
+
context "when attribute has no size" do
|
137
|
+
let(:foo) { double }
|
138
138
|
it { is_expected.to be_invalid_with_error :foo, :size_less_than }
|
139
139
|
end
|
140
140
|
end
|
@@ -159,8 +159,8 @@ RSpec.describe SizeValidator do
|
|
159
159
|
end
|
160
160
|
end
|
161
161
|
|
162
|
-
context "when attribute
|
163
|
-
let(:foo) {
|
162
|
+
context "when attribute has no size" do
|
163
|
+
let(:foo) { double }
|
164
164
|
it do
|
165
165
|
is_expected.to be_invalid_with_error :foo, :size_less_than_or_equal_to
|
166
166
|
end
|
@@ -189,8 +189,8 @@ RSpec.describe SizeValidator do
|
|
189
189
|
end
|
190
190
|
end
|
191
191
|
|
192
|
-
context "when attribute
|
193
|
-
let(:foo) {
|
192
|
+
context "when attribute has no size" do
|
193
|
+
let(:foo) { double }
|
194
194
|
it do
|
195
195
|
is_expected.to be_invalid_with_error :foo, :size_equal_to_bar_baz
|
196
196
|
end
|
@@ -217,8 +217,8 @@ RSpec.describe SizeValidator do
|
|
217
217
|
it { is_expected.to be_valid }
|
218
218
|
end
|
219
219
|
|
220
|
-
context "when attribute
|
221
|
-
let(:foo) {
|
220
|
+
context "when attribute has no size" do
|
221
|
+
let(:foo) { double }
|
222
222
|
it do
|
223
223
|
is_expected.to be_invalid_with_error :foo, :size_other_than_bar_baz
|
224
224
|
end
|
@@ -247,8 +247,8 @@ RSpec.describe SizeValidator do
|
|
247
247
|
it { is_expected.to be_valid }
|
248
248
|
end
|
249
249
|
|
250
|
-
context "when attribute
|
251
|
-
let(:foo) {
|
250
|
+
context "when attribute has no size" do
|
251
|
+
let(:foo) { double }
|
252
252
|
it do
|
253
253
|
is_expected.to be_invalid_with_error :foo, :size_greater_than_bar_baz
|
254
254
|
end
|
@@ -280,8 +280,8 @@ RSpec.describe SizeValidator do
|
|
280
280
|
it { is_expected.to be_valid }
|
281
281
|
end
|
282
282
|
|
283
|
-
context "when attribute
|
284
|
-
let(:foo) {
|
283
|
+
context "when attribute has no size" do
|
284
|
+
let(:foo) { double }
|
285
285
|
it do
|
286
286
|
is_expected
|
287
287
|
.to be_invalid_with_error :foo, :size_greater_than_or_equal_to_bar_baz
|
@@ -307,8 +307,8 @@ RSpec.describe SizeValidator do
|
|
307
307
|
it { is_expected.to be_invalid_with_error :foo, :size_less_than_bar_baz }
|
308
308
|
end
|
309
309
|
|
310
|
-
context "when attribute
|
311
|
-
let(:foo) {
|
310
|
+
context "when attribute has no size" do
|
311
|
+
let(:foo) { double }
|
312
312
|
it { is_expected.to be_invalid_with_error :foo, :size_less_than_bar_baz }
|
313
313
|
end
|
314
314
|
end
|
@@ -336,8 +336,8 @@ RSpec.describe SizeValidator do
|
|
336
336
|
end
|
337
337
|
end
|
338
338
|
|
339
|
-
context "when attribute
|
340
|
-
let(:foo) {
|
339
|
+
context "when attribute has no size" do
|
340
|
+
let(:foo) { double }
|
341
341
|
it do
|
342
342
|
is_expected.to be_invalid_with_error \
|
343
343
|
:foo, :size_less_than_or_equal_to_bar_baz
|
data/tram-validators.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tram-validators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kozin (nepalez)
|
@@ -73,12 +73,14 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files:
|
75
75
|
- README.md
|
76
|
+
- CHANGELOG.md
|
76
77
|
files:
|
77
78
|
- ".codeclimate.yml"
|
78
79
|
- ".gitignore"
|
79
80
|
- ".rspec"
|
80
81
|
- ".rubocop.yml"
|
81
82
|
- ".travis.yml"
|
83
|
+
- CHANGELOG.md
|
82
84
|
- Gemfile
|
83
85
|
- LICENSE.txt
|
84
86
|
- README.md
|