parametric 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/README.md +9 -0
- data/lib/parametric/field_dsl.rb +4 -0
- data/lib/parametric/version.rb +1 -1
- data/spec/field_spec.rb +8 -0
- data/spec/validators_spec.rb +9 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f882efaecdc92a64f9f74bf8c26545dc9d1f6610
|
4
|
+
data.tar.gz: db613b987b0d2f3b02470ef04371310840e047f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a4b6866c5c0936d92c4b06042c2b6fbae2c25f9cf6d39454e9949f5d60617dd85e0e6eaf4bd832361a4f160ac0d2df7f984a384b15de508471e61a8830da458
|
7
|
+
data.tar.gz: 9e152c1a76b4db393cb2d221b8f8e55cdcb08796ee860af789c9c72225aa1479cb53fb0f2efeb18284d9c25f91adf4823963abdf7eb2e05384885cd200146bb9
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -274,6 +274,11 @@ class MyPolicy
|
|
274
274
|
def valid?(value, key, payload)
|
275
275
|
true
|
276
276
|
end
|
277
|
+
|
278
|
+
# merge this object into the field's meta data
|
279
|
+
def meta_data
|
280
|
+
{type: :string}
|
281
|
+
end
|
277
282
|
end
|
278
283
|
```
|
279
284
|
|
@@ -327,6 +332,10 @@ class AddJobTitle
|
|
327
332
|
def valid?(value, key, payload)
|
328
333
|
true
|
329
334
|
end
|
335
|
+
|
336
|
+
def meta_data
|
337
|
+
{}
|
338
|
+
end
|
330
339
|
end
|
331
340
|
|
332
341
|
# Register it
|
data/lib/parametric/field_dsl.rb
CHANGED
data/lib/parametric/version.rb
CHANGED
data/spec/field_spec.rb
CHANGED
@@ -251,6 +251,14 @@ describe Parametric::Field do
|
|
251
251
|
end
|
252
252
|
end
|
253
253
|
|
254
|
+
it "is available as method" do
|
255
|
+
resolve(subject.declared.present, a_key: "").tap do |r|
|
256
|
+
expect(r.eligible?).to be true
|
257
|
+
has_errors
|
258
|
+
expect(r.value).to eq ""
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
254
262
|
it "is not eligible if key does not exist" do
|
255
263
|
resolve(subject.policy(:declared).present, foo: "").tap do |r|
|
256
264
|
expect(r.eligible?).to be false
|
data/spec/validators_spec.rb
CHANGED
@@ -43,6 +43,15 @@ describe 'default validators' do
|
|
43
43
|
}
|
44
44
|
end
|
45
45
|
|
46
|
+
describe ':declared' do
|
47
|
+
it {
|
48
|
+
test_validator({key: 'foo'}, :key, :declared, true, true)
|
49
|
+
test_validator({key: ''}, :key, :declared, true, true)
|
50
|
+
test_validator({key: nil}, :key, :declared, true, true)
|
51
|
+
test_validator({foo: 'foo'}, :key, :declared, false, true)
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
46
55
|
describe ':gt' do
|
47
56
|
it {
|
48
57
|
test_validator({key: 10}, :key, :gt, true, true, 9)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parametric
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ismael Celis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
version: '0'
|
126
126
|
requirements: []
|
127
127
|
rubyforge_project:
|
128
|
-
rubygems_version: 2.
|
128
|
+
rubygems_version: 2.5.1
|
129
129
|
signing_key:
|
130
130
|
specification_version: 4
|
131
131
|
summary: DSL for declaring allowed parameters with options, regexp patern and default
|