tram-validators 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aca5b01edeaa35458d5ba907676b8bed73a60f1e
4
- data.tar.gz: 9c65185129ee67af6848516c0623405676176383
3
+ metadata.gz: 051a300329482a3a9e2fb6fd94b0b1524dfa4414
4
+ data.tar.gz: 1ba098b3f8491e39685344c6b6d3388974cb432b
5
5
  SHA512:
6
- metadata.gz: dcf7914965ea2df8011562c7dc85b4f0f5fd22fe388421558394fdbcb6e39ec6cc5fbb885f79dc0a024a7bc4016159770791c855db8ba51a44a8135af0bcaaf0
7
- data.tar.gz: 61dd66c80636c75067a5c2eb438d682a3fae75a818113f905e5d806296a741e1243f516a544059ddae681d2206a2ca16e1460dbb34f472d4a4f64f33d0def8b6
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.is_a? Array
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 is not an array" do
33
- let(:foo) { 1 }
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 is not an array" do
57
- let(:foo) { 1 }
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 is not an array" do
81
- let(:foo) { 1 }
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 is not an array" do
110
- let(:foo) { 1 }
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 is not an array" do
137
- let(:foo) { 1 }
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 is not an array" do
163
- let(:foo) { 1 }
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 is not an array" do
193
- let(:foo) { 1 }
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 is not an array" do
221
- let(:foo) { 1 }
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 is not an array" do
251
- let(:foo) { 1 }
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 is not an array" do
284
- let(:foo) { 1 }
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 is not an array" do
311
- let(:foo) { 1 }
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 is not an array" do
340
- let(:foo) { 1 }
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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = "tram-validators"
3
- gem.version = "0.0.1"
3
+ gem.version = "0.0.2"
4
4
  gem.author = "Andrew Kozin (nepalez)"
5
5
  gem.email = "andrew.kozin@gmail.com"
6
6
  gem.homepage = "https://github.com/tram-rb/tram-validators"
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.1
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