(playbacker cassette order-scope)
Given a cassette, returns a stateful function which, when called with the var name and the arguments key, either throws an exception if the ordering has been violated or returns the return value for that call.
order-scope can be: :global all requests must come in the same order they were recorded in :var all requests to the same function must come in the same order :key requests can come in (more or less) any order, as ordering is only scoped to the arg key
Given a cassette, returns a stateful function which, when called with the var name and the arguments key, either throws an exception if the ordering has been violated or returns the return value for that call. order-scope can be: :global all requests must come in the same order they were recorded in :var all requests to the same function must come in the same order :key requests can come in (more or less) any order, as ordering is only scoped to the arg key
(record specs func)
Redefs the vars to record the calls, and returns [val cassette] where val is the return value of func.
Redefs the vars to record the calls, and returns [val cassette] where val is the return value of func.
(with-cassette cname specs & body)
Each spec is: { :var a var
;; the rest are optional
:arg-transformer a function with the same arg signature as the var, which is expected to returns a vector of equivalent arguments. During recording/playback, the original arguments to the function call are passed through this transformer, and the transformed arguments are passed to arg-key-fn, recordable? and the recorded function. Defaults to clojure.core/vector. :arg-key-fn a function of the same arguments as the var that is expected to return a value that can be stored and compared for equality to the expected call. Defaults to clojure.core/vector. :recordable? a predicate with the same arg signature as the var. If the predicate returns false/nil on any call, the call will be passed through transparently to the original function without recording/playback. :return-transformer a function that the return value will be passed through while recording, which can be useful for doing things like ensuring serializability. }
Each spec is: { :var a var ;; the rest are optional :arg-transformer a function with the same arg signature as the var, which is expected to returns a vector of equivalent arguments. During recording/playback, the original arguments to the function call are passed through this transformer, and the transformed arguments are passed to arg-key-fn, recordable? and the recorded function. Defaults to clojure.core/vector. :arg-key-fn a function of the same arguments as the var that is expected to return a value that can be stored and compared for equality to the expected call. Defaults to clojure.core/vector. :recordable? a predicate with the same arg signature as the var. If the predicate returns false/nil on any call, the call will be passed through transparently to the original function without recording/playback. :return-transformer a function that the return value will be passed through while recording, which can be useful for doing things like ensuring serializability. }
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close