schemacop 2.4.1 → 2.4.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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +0 -9
  4. data/VERSION +1 -1
  5. data/doc/Schemacop.html +1 -1
  6. data/doc/Schemacop/ArrayValidator.html +1 -1
  7. data/doc/Schemacop/BooleanValidator.html +1 -1
  8. data/doc/Schemacop/Caster.html +1 -1
  9. data/doc/Schemacop/Collector.html +1 -1
  10. data/doc/Schemacop/Exceptions.html +1 -1
  11. data/doc/Schemacop/Exceptions/InvalidSchemaError.html +1 -1
  12. data/doc/Schemacop/Exceptions/ValidationError.html +1 -1
  13. data/doc/Schemacop/FieldNode.html +1 -1
  14. data/doc/Schemacop/FloatValidator.html +1 -1
  15. data/doc/Schemacop/HashValidator.html +1 -1
  16. data/doc/Schemacop/IntegerValidator.html +1 -1
  17. data/doc/Schemacop/NilValidator.html +1 -1
  18. data/doc/Schemacop/Node.html +1 -1
  19. data/doc/Schemacop/NodeResolver.html +1 -1
  20. data/doc/Schemacop/NodeSupportingField.html +1 -1
  21. data/doc/Schemacop/NodeSupportingType.html +1 -1
  22. data/doc/Schemacop/NodeWithBlock.html +1 -1
  23. data/doc/Schemacop/NumberValidator.html +1 -1
  24. data/doc/Schemacop/ObjectValidator.html +1 -1
  25. data/doc/Schemacop/RootNode.html +1 -1
  26. data/doc/Schemacop/Schema.html +1 -1
  27. data/doc/Schemacop/StringValidator.html +1 -1
  28. data/doc/Schemacop/SymbolValidator.html +1 -1
  29. data/doc/ScopedEnv.html +1 -1
  30. data/doc/_index.html +1 -1
  31. data/doc/file.README.html +1 -9
  32. data/doc/index.html +1 -9
  33. data/doc/top-level-namespace.html +1 -1
  34. data/lib/schemacop/validator/object_validator.rb +1 -1
  35. data/schemacop.gemspec +3 -3
  36. data/test/short_forms_test.rb +11 -0
  37. data/test/validator_object_test.rb +34 -0
  38. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ecc0bb69ecb7c86b6c507928ff2568a3fc0e5a5927d414eaf34a3817accbcd1b
4
- data.tar.gz: fbe0e82379f5f330b60a71717ebcefa4bd1280c59a61e7de8e4ccfad137852c2
3
+ metadata.gz: 284778e0dc9374078941733ba45f3dab360ff90f275d23eaee3c882c1ace0b5e
4
+ data.tar.gz: 588efa687de9242df98e10ebe3772dafdbd0ad8252be77d093a41cde0c6edf70
5
5
  SHA512:
6
- metadata.gz: c6406092916323732d4b99972bd77e5ab87b6cc45331dce34d72f0f666bdb6a526b35df900a393bf0c2e6164771f91509c42d97b29a7f0a9f60d75b0ca1a25b9
7
- data.tar.gz: f30be0a5a40a75812b8f75a2d298019bbd99022479261365210933b1038768512da1f03925d930e9fe80696a104da98c5f826e83b7fad2140cb4b0781b9d201d
6
+ metadata.gz: a19de3aa6914daf4287b76573d1cf19cc922b1d17b8b65d9d588dfe2775d2c6143f2b1543fd829b99533971730b984d2e1d058d3aee754fc4bc110d6b2b6e9b2
7
+ data.tar.gz: 021a2c156fdef4fe95f42e4f7b498fcf28eb5ba1adaa6ec1163da67bebb70f82971b88a828083d92cc8d6637d25569529b9e419744dd884326d01a6d98d4dd18
@@ -10,6 +10,14 @@
10
10
  ### Changes
11
11
  -->
12
12
 
13
+ ## 2.4.2 (2019-11-05)
14
+
15
+ ### Bug fixes
16
+
17
+ * The object validator, if given no classes, now supports any object of classes
18
+ that derive from `BasicObject`. This allows you to specify types that reside
19
+ out of the ruby standard library, such as `Tempfile`.
20
+
13
21
  ## 2.4.1 (2019-10-28)
14
22
 
15
23
  ### Bug fixes
data/README.md CHANGED
@@ -739,9 +739,6 @@ Schemacop will throw one of the following checked exceptions:
739
739
 
740
740
  * Schemacop does not yet allow cyclic structures with infinite depth.
741
741
 
742
- * Schemacop aborts when it encounters an error. It is not able to collect a full
743
- list of multiple errors.
744
-
745
742
  * Schemacop is not made for validating complex causalities (i.e. field `a`
746
743
  needs to be given only if field `b` is present).
747
744
 
@@ -760,12 +757,6 @@ To run tests:
760
757
  * Run `bundle exec rake test TEST=test/unit/some/file.rb` to run a single test
761
758
  file
762
759
 
763
- ## Contributors
764
-
765
- Thanks to [Rubocop](https://github.com/bbatsov/rubocop) for great inspiration
766
- concerning their name and the structure of their README file. And special thanks
767
- to [SubGit](http://www.subgit.com/) for their great open source licensing.
768
-
769
760
  ## Copyright
770
761
 
771
762
  Copyright (c) 2019 Sitrox. See `LICENSE` for further details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.4.1
1
+ 2.4.2
@@ -136,7 +136,7 @@
136
136
  </div>
137
137
 
138
138
  <div id="footer">
139
- Generated on Mon Oct 28 16:25:03 2019 by
139
+ Generated on Tue Nov 5 11:16:27 2019 by
140
140
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
141
141
  0.9.20 (ruby-2.6.2).
142
142
  </div>
@@ -319,7 +319,7 @@
319
319
  </div>
320
320
 
321
321
  <div id="footer">
322
- Generated on Mon Oct 28 16:25:04 2019 by
322
+ Generated on Tue Nov 5 11:16:28 2019 by
323
323
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
324
324
  0.9.20 (ruby-2.6.2).
325
325
  </div>
@@ -135,7 +135,7 @@
135
135
  </div>
136
136
 
137
137
  <div id="footer">
138
- Generated on Mon Oct 28 16:25:04 2019 by
138
+ Generated on Tue Nov 5 11:16:28 2019 by
139
139
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
140
140
  0.9.20 (ruby-2.6.2).
141
141
  </div>
@@ -369,7 +369,7 @@
369
369
  </div>
370
370
 
371
371
  <div id="footer">
372
- Generated on Mon Oct 28 16:25:03 2019 by
372
+ Generated on Tue Nov 5 11:16:28 2019 by
373
373
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
374
374
  0.9.20 (ruby-2.6.2).
375
375
  </div>
@@ -777,7 +777,7 @@ called.</p>
777
777
  </div>
778
778
 
779
779
  <div id="footer">
780
- Generated on Mon Oct 28 16:25:04 2019 by
780
+ Generated on Tue Nov 5 11:16:28 2019 by
781
781
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
782
782
  0.9.20 (ruby-2.6.2).
783
783
  </div>
@@ -105,7 +105,7 @@
105
105
  </div>
106
106
 
107
107
  <div id="footer">
108
- Generated on Mon Oct 28 16:25:03 2019 by
108
+ Generated on Tue Nov 5 11:16:27 2019 by
109
109
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
110
110
  0.9.20 (ruby-2.6.2).
111
111
  </div>
@@ -114,7 +114,7 @@
114
114
  </div>
115
115
 
116
116
  <div id="footer">
117
- Generated on Mon Oct 28 16:25:04 2019 by
117
+ Generated on Tue Nov 5 11:16:28 2019 by
118
118
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
119
119
  0.9.20 (ruby-2.6.2).
120
120
  </div>
@@ -114,7 +114,7 @@
114
114
  </div>
115
115
 
116
116
  <div id="footer">
117
- Generated on Mon Oct 28 16:25:04 2019 by
117
+ Generated on Tue Nov 5 11:16:28 2019 by
118
118
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
119
119
  0.9.20 (ruby-2.6.2).
120
120
  </div>
@@ -411,7 +411,7 @@
411
411
  </div>
412
412
 
413
413
  <div id="footer">
414
- Generated on Mon Oct 28 16:25:04 2019 by
414
+ Generated on Tue Nov 5 11:16:28 2019 by
415
415
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
416
416
  0.9.20 (ruby-2.6.2).
417
417
  </div>
@@ -148,7 +148,7 @@
148
148
  </div>
149
149
 
150
150
  <div id="footer">
151
- Generated on Mon Oct 28 16:25:04 2019 by
151
+ Generated on Tue Nov 5 11:16:28 2019 by
152
152
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
153
153
  0.9.20 (ruby-2.6.2).
154
154
  </div>
@@ -279,7 +279,7 @@
279
279
  </div>
280
280
 
281
281
  <div id="footer">
282
- Generated on Mon Oct 28 16:25:04 2019 by
282
+ Generated on Tue Nov 5 11:16:28 2019 by
283
283
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
284
284
  0.9.20 (ruby-2.6.2).
285
285
  </div>
@@ -148,7 +148,7 @@
148
148
  </div>
149
149
 
150
150
  <div id="footer">
151
- Generated on Mon Oct 28 16:25:04 2019 by
151
+ Generated on Tue Nov 5 11:16:28 2019 by
152
152
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
153
153
  0.9.20 (ruby-2.6.2).
154
154
  </div>
@@ -135,7 +135,7 @@
135
135
  </div>
136
136
 
137
137
  <div id="footer">
138
- Generated on Mon Oct 28 16:25:04 2019 by
138
+ Generated on Tue Nov 5 11:16:28 2019 by
139
139
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
140
140
  0.9.20 (ruby-2.6.2).
141
141
  </div>
@@ -1428,7 +1428,7 @@
1428
1428
  </div>
1429
1429
 
1430
1430
  <div id="footer">
1431
- Generated on Mon Oct 28 16:25:03 2019 by
1431
+ Generated on Tue Nov 5 11:16:27 2019 by
1432
1432
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1433
1433
  0.9.20 (ruby-2.6.2).
1434
1434
  </div>
@@ -248,7 +248,7 @@
248
248
  </div>
249
249
 
250
250
  <div id="footer">
251
- Generated on Mon Oct 28 16:25:04 2019 by
251
+ Generated on Tue Nov 5 11:16:28 2019 by
252
252
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
253
253
  0.9.20 (ruby-2.6.2).
254
254
  </div>
@@ -580,7 +580,7 @@
580
580
  </div>
581
581
 
582
582
  <div id="footer">
583
- Generated on Mon Oct 28 16:25:04 2019 by
583
+ Generated on Tue Nov 5 11:16:28 2019 by
584
584
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
585
585
  0.9.20 (ruby-2.6.2).
586
586
  </div>
@@ -602,7 +602,7 @@ as it formerly was the case in the constructor.</p>
602
602
  </div>
603
603
 
604
604
  <div id="footer">
605
- Generated on Mon Oct 28 16:25:04 2019 by
605
+ Generated on Tue Nov 5 11:16:28 2019 by
606
606
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
607
607
  0.9.20 (ruby-2.6.2).
608
608
  </div>
@@ -279,7 +279,7 @@
279
279
  </div>
280
280
 
281
281
  <div id="footer">
282
- Generated on Mon Oct 28 16:25:04 2019 by
282
+ Generated on Tue Nov 5 11:16:28 2019 by
283
283
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
284
284
  0.9.20 (ruby-2.6.2).
285
285
  </div>
@@ -222,7 +222,7 @@
222
222
  </div>
223
223
 
224
224
  <div id="footer">
225
- Generated on Mon Oct 28 16:25:04 2019 by
225
+ Generated on Tue Nov 5 11:16:28 2019 by
226
226
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
227
227
  0.9.20 (ruby-2.6.2).
228
228
  </div>
@@ -288,7 +288,7 @@
288
288
  </div>
289
289
 
290
290
  <div id="footer">
291
- Generated on Mon Oct 28 16:25:04 2019 by
291
+ Generated on Tue Nov 5 11:16:28 2019 by
292
292
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
293
293
  0.9.20 (ruby-2.6.2).
294
294
  </div>
@@ -161,7 +161,7 @@
161
161
  </div>
162
162
 
163
163
  <div id="footer">
164
- Generated on Mon Oct 28 16:25:04 2019 by
164
+ Generated on Tue Nov 5 11:16:28 2019 by
165
165
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
166
166
  0.9.20 (ruby-2.6.2).
167
167
  </div>
@@ -687,7 +687,7 @@ this exception is thrown.</p>
687
687
  </div>
688
688
 
689
689
  <div id="footer">
690
- Generated on Mon Oct 28 16:25:03 2019 by
690
+ Generated on Tue Nov 5 11:16:28 2019 by
691
691
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
692
692
  0.9.20 (ruby-2.6.2).
693
693
  </div>
@@ -285,7 +285,7 @@
285
285
  </div>
286
286
 
287
287
  <div id="footer">
288
- Generated on Mon Oct 28 16:25:04 2019 by
288
+ Generated on Tue Nov 5 11:16:28 2019 by
289
289
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
290
290
  0.9.20 (ruby-2.6.2).
291
291
  </div>
@@ -135,7 +135,7 @@
135
135
  </div>
136
136
 
137
137
  <div id="footer">
138
- Generated on Mon Oct 28 16:25:04 2019 by
138
+ Generated on Tue Nov 5 11:16:28 2019 by
139
139
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
140
140
  0.9.20 (ruby-2.6.2).
141
141
  </div>
@@ -341,7 +341,7 @@
341
341
  </div>
342
342
 
343
343
  <div id="footer">
344
- Generated on Mon Oct 28 16:25:04 2019 by
344
+ Generated on Tue Nov 5 11:16:28 2019 by
345
345
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
346
346
  0.9.20 (ruby-2.6.2).
347
347
  </div>
@@ -354,7 +354,7 @@
354
354
  </div>
355
355
 
356
356
  <div id="footer">
357
- Generated on Mon Oct 28 16:25:03 2019 by
357
+ Generated on Tue Nov 5 11:16:27 2019 by
358
358
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
359
359
  0.9.20 (ruby-2.6.2).
360
360
  </div>
@@ -785,8 +785,6 @@ would made it unclear what to cast a string into:</p>
785
785
 
786
786
  <ul>
787
787
  <li><p>Schemacop does not yet allow cyclic structures with infinite depth.</p></li>
788
- <li><p>Schemacop aborts when it encounters an error. It is not able to collect a full
789
- list of multiple errors.</p></li>
790
788
  <li><p>Schemacop is not made for validating complex causalities (i.e. field <code>a</code>
791
789
  needs to be given only if field <code>b</code> is present).</p></li>
792
790
  <li><p>Schemacop does not yet support string regex matching.</p></li>
@@ -804,19 +802,13 @@ needs to be given only if field <code>b</code> is present).</p></li>
804
802
  file</p></li>
805
803
  </ul>
806
804
 
807
- <h2>Contributors</h2>
808
-
809
- <p>Thanks to <a href="https://github.com/bbatsov/rubocop">Rubocop</a> for great inspiration
810
- concerning their name and the structure of their README file. And special thanks
811
- to <a href="http://www.subgit.com/">SubGit</a> for their great open source licensing.</p>
812
-
813
805
  <h2>Copyright</h2>
814
806
 
815
807
  <p>Copyright (c) 2019 Sitrox. See <code>LICENSE</code> for further details.</p>
816
808
  </div></div>
817
809
 
818
810
  <div id="footer">
819
- Generated on Mon Oct 28 16:25:03 2019 by
811
+ Generated on Tue Nov 5 11:16:27 2019 by
820
812
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
821
813
  0.9.20 (ruby-2.6.2).
822
814
  </div>
@@ -785,8 +785,6 @@ would made it unclear what to cast a string into:</p>
785
785
 
786
786
  <ul>
787
787
  <li><p>Schemacop does not yet allow cyclic structures with infinite depth.</p></li>
788
- <li><p>Schemacop aborts when it encounters an error. It is not able to collect a full
789
- list of multiple errors.</p></li>
790
788
  <li><p>Schemacop is not made for validating complex causalities (i.e. field <code>a</code>
791
789
  needs to be given only if field <code>b</code> is present).</p></li>
792
790
  <li><p>Schemacop does not yet support string regex matching.</p></li>
@@ -804,19 +802,13 @@ needs to be given only if field <code>b</code> is present).</p></li>
804
802
  file</p></li>
805
803
  </ul>
806
804
 
807
- <h2>Contributors</h2>
808
-
809
- <p>Thanks to <a href="https://github.com/bbatsov/rubocop">Rubocop</a> for great inspiration
810
- concerning their name and the structure of their README file. And special thanks
811
- to <a href="http://www.subgit.com/">SubGit</a> for their great open source licensing.</p>
812
-
813
805
  <h2>Copyright</h2>
814
806
 
815
807
  <p>Copyright (c) 2019 Sitrox. See <code>LICENSE</code> for further details.</p>
816
808
  </div></div>
817
809
 
818
810
  <div id="footer">
819
- Generated on Mon Oct 28 16:25:03 2019 by
811
+ Generated on Tue Nov 5 11:16:27 2019 by
820
812
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
821
813
  0.9.20 (ruby-2.6.2).
822
814
  </div>
@@ -102,7 +102,7 @@
102
102
  </div>
103
103
 
104
104
  <div id="footer">
105
- Generated on Mon Oct 28 16:25:03 2019 by
105
+ Generated on Tue Nov 5 11:16:27 2019 by
106
106
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
107
107
  0.9.20 (ruby-2.6.2).
108
108
  </div>
@@ -1,6 +1,6 @@
1
1
  module Schemacop
2
2
  class ObjectValidator < Node
3
- register symbols: :object, klasses: Object
3
+ register symbols: :object, klasses: BasicObject
4
4
 
5
5
  option :classes
6
6
  option :strict
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: schemacop 2.4.1 ruby lib
2
+ # stub: schemacop 2.4.2 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "schemacop".freeze
6
- s.version = "2.4.1"
6
+ s.version = "2.4.2"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
10
10
  s.authors = ["Sitrox".freeze]
11
- s.date = "2019-10-28"
11
+ s.date = "2019-11-05"
12
12
  s.files = [".gitignore".freeze, ".releaser_config".freeze, ".rubocop.yml".freeze, ".travis.yml".freeze, ".yardopts".freeze, "CHANGELOG.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "RUBY_VERSION".freeze, "Rakefile".freeze, "VERSION".freeze, "doc/Schemacop.html".freeze, "doc/Schemacop/ArrayValidator.html".freeze, "doc/Schemacop/BooleanValidator.html".freeze, "doc/Schemacop/Caster.html".freeze, "doc/Schemacop/Collector.html".freeze, "doc/Schemacop/Exceptions.html".freeze, "doc/Schemacop/Exceptions/InvalidSchemaError.html".freeze, "doc/Schemacop/Exceptions/ValidationError.html".freeze, "doc/Schemacop/FieldNode.html".freeze, "doc/Schemacop/FloatValidator.html".freeze, "doc/Schemacop/HashValidator.html".freeze, "doc/Schemacop/IntegerValidator.html".freeze, "doc/Schemacop/NilValidator.html".freeze, "doc/Schemacop/Node.html".freeze, "doc/Schemacop/NodeResolver.html".freeze, "doc/Schemacop/NodeSupportingField.html".freeze, "doc/Schemacop/NodeSupportingType.html".freeze, "doc/Schemacop/NodeWithBlock.html".freeze, "doc/Schemacop/NumberValidator.html".freeze, "doc/Schemacop/ObjectValidator.html".freeze, "doc/Schemacop/RootNode.html".freeze, "doc/Schemacop/Schema.html".freeze, "doc/Schemacop/StringValidator.html".freeze, "doc/Schemacop/SymbolValidator.html".freeze, "doc/ScopedEnv.html".freeze, "doc/_index.html".freeze, "doc/class_list.html".freeze, "doc/css/common.css".freeze, "doc/css/full_list.css".freeze, "doc/css/style.css".freeze, "doc/file.README.html".freeze, "doc/file_list.html".freeze, "doc/frames.html".freeze, "doc/index.html".freeze, "doc/inheritance.graphml".freeze, "doc/inheritance.pdf".freeze, "doc/js/app.js".freeze, "doc/js/full_list.js".freeze, "doc/js/jquery.js".freeze, "doc/method_list.html".freeze, "doc/top-level-namespace.html".freeze, "lib/schemacop.rb".freeze, "lib/schemacop/caster.rb".freeze, "lib/schemacop/collector.rb".freeze, "lib/schemacop/exceptions.rb".freeze, "lib/schemacop/field_node.rb".freeze, "lib/schemacop/node.rb".freeze, "lib/schemacop/node_resolver.rb".freeze, "lib/schemacop/node_supporting_field.rb".freeze, "lib/schemacop/node_supporting_type.rb".freeze, "lib/schemacop/node_with_block.rb".freeze, "lib/schemacop/root_node.rb".freeze, "lib/schemacop/schema.rb".freeze, "lib/schemacop/scoped_env.rb".freeze, "lib/schemacop/validator/array_validator.rb".freeze, "lib/schemacop/validator/boolean_validator.rb".freeze, "lib/schemacop/validator/float_validator.rb".freeze, "lib/schemacop/validator/hash_validator.rb".freeze, "lib/schemacop/validator/integer_validator.rb".freeze, "lib/schemacop/validator/nil_validator.rb".freeze, "lib/schemacop/validator/number_validator.rb".freeze, "lib/schemacop/validator/object_validator.rb".freeze, "lib/schemacop/validator/string_validator.rb".freeze, "lib/schemacop/validator/symbol_validator.rb".freeze, "schemacop.gemspec".freeze, "test/casting_test.rb".freeze, "test/collector_test.rb".freeze, "test/custom_check_test.rb".freeze, "test/custom_if_test.rb".freeze, "test/defaults_test.rb".freeze, "test/nil_dis_allow_test.rb".freeze, "test/node_resolver_test.rb".freeze, "test/short_forms_test.rb".freeze, "test/test_helper.rb".freeze, "test/types_test.rb".freeze, "test/validator_array_test.rb".freeze, "test/validator_boolean_test.rb".freeze, "test/validator_float_test.rb".freeze, "test/validator_hash_test.rb".freeze, "test/validator_integer_test.rb".freeze, "test/validator_nil_test.rb".freeze, "test/validator_number_test.rb".freeze, "test/validator_object_test.rb".freeze, "test/validator_string_test.rb".freeze, "test/validator_symbol_test.rb".freeze]
13
13
  s.homepage = "https://github.com/sitrox/schemacop".freeze
14
14
  s.licenses = ["MIT".freeze]
@@ -5,6 +5,17 @@ module Schemacop
5
5
  class User; end
6
6
  class Group; end
7
7
 
8
+ def test_untyped
9
+ s = Schema.new do
10
+ req :foo
11
+ end
12
+
13
+ assert_nothing_raised { s.validate!(foo: 3) }
14
+ assert_nothing_raised { s.validate!(foo: '42') }
15
+ assert_nothing_raised { s.validate!(foo: Object.new) }
16
+ assert_verr { s.validate!(foo: nil) }
17
+ end
18
+
8
19
  def test_constructor_defaults_to_hash
9
20
  s = Schema.new do
10
21
  req! :r do
@@ -17,6 +17,40 @@ module Schemacop
17
17
  assert_verr { s.validate!(AdminUser.new) }
18
18
  end
19
19
 
20
+ # In modern versions of ruby, some classes such as Tempfile are not derived
21
+ # from Object but from BasicObject. Before the time of writing this test,
22
+ # the ObjectValidator only accepted subclasses of Object and classes like
23
+ # Tempfile did not work at all. This test ensures that this is working now.
24
+ def test_basic_object
25
+ refute Tempfile <= Object
26
+ assert Tempfile <= BasicObject
27
+
28
+ s = Schema.new do
29
+ type :object
30
+ end
31
+
32
+ assert_nothing_raised { s.validate!(Tempfile.new) }
33
+
34
+ s = Schema.new do
35
+ req :foo
36
+ end
37
+
38
+ assert_nothing_raised { s.validate!(foo: Tempfile.new) }
39
+
40
+ s = Schema.new do
41
+ req :foo, Tempfile
42
+ end
43
+
44
+ assert_nothing_raised { s.validate!(foo: Tempfile.new) }
45
+ assert_verr { s.validate!(foo: Time.new) }
46
+
47
+ s = Schema.new do
48
+ req :foo, :object, classes: Tempfile
49
+ end
50
+
51
+ assert_nothing_raised { s.validate!(foo: Tempfile.new) }
52
+ end
53
+
20
54
  def test_multiple_classes_long
21
55
  s = Schema.new do
22
56
  type :object, classes: User
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schemacop
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.1
4
+ version: 2.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sitrox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-28 00:00:00.000000000 Z
11
+ date: 2019-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport