Fork me on GitHub
#testing
<
2017-03-22
>
jumar08:03:37

@olfal I think with-redefs is the usual approach.

jumar08:03:50

I don't know Midje, but it might be that provided can be used for this: https://github.com/marick/Midje/wiki/Prerequisites-that-throw-exceptions

jumar08:03:41

However, I personally prefer expectations - but I don't think there's any built in support for mocking functions to make them throw exceptions.

olfal12:03:26

Thanks @jumar! Midje looks great, I will try it out

metametadata17:03:21

@olfal you may also like clj-fakes: https://github.com/metametadata/clj-fakes

(f/with-fakes
  (f/patch! #'funcs/sum (f/fake [[5 6] (fn [_ _] (throw (ex-info "wow" {})))]))
  (funcs/sum 5 6)) ; => raises "wow" exception