clojure-spec

About: http://clojure.org/about/spec Guide: http://clojure.org/guides/spec API: https://clojure.github.io/spec.alpha/clojure.spec.alpha-api.html
walterl 2020-07-10T22:36:05.461300Z

Hi everyone. I'm still pretty new to spec, and can't figure out what's wrong with this simple spec with a generator fn:

(s/def :offset-date-time
  (s/with-gen (partial instance? OffsetDateTime)
    #(OffsetDateTime/now)))
(s/gen :offset-date-time) fails with
Execution error (AssertionError) at clojure.test.check.generators/such-that (generators.cljc:346).
Assert failed: Second arg to such-that must be a generator
(generator? gen)
Any ideas?

2020-07-10T22:37:08.461500Z

That's not a generator

2020-07-10T22:37:47.462300Z

Generators are special objects from spec's generators namespace

walterl 2020-07-10T22:38:32.462500Z

Ah!

walterl 2020-07-10T22:38:41.463Z

Thanks, @gfredericks

👍 1