Closed nichtich closed 6 years ago
Commit 11c97a4 by @phochste should not be part of this pr.
Randomly marking records as invalid doesn't seem very helpful for testing purposes. A Catmandu::Validator::Mock that marks records as invalid in a predictable manner would be very useful.
Every validator that marks items as valid based on their content is not mocking but an actual validator. Such validators will be useful but you end up creating your own schema language. How about the alternative given in https://github.com/LibreCat/Catmandu/pull/338 with a default validator that only rejects if a given environment variable is set?
How about a Mock validator that throws and error is a string value is larger than N
bytes? Or, throws an error when the error
field is set? It is that in test environments (travis and all that) we don't want to depend on random behaviour of methods... the same input should give the same output.
I'm adding a Mock validator that rejects based on a flag
superseded by #338
This includes some refactoring of Catmandu::Env which could be extended even further for stores.