So I lied, I couldn't resist doing just one more:

(defn some-fn [] nil)

(fact "calls the anonymous function that undo-fn returns"
  (undo-patch ...patch...) => @patches-
  (provided
    (undo-fn ...patch...) => some-fn
    (some-fn) => nil))

The two provided statements are mboth mocking and stubbing.  So if either of
those functions isn't called with the expected arguments they will fail.
 The line
(undo-patch ...patch...) => @patches- is saying when I call undo-patch with
any patch, it should return the value inside of patches-  This is probably
ok, since the different undo-fns are thoroughly unit tested.

There might be some better way to not have to create that some-fn that we
just use for testing.  Maybe put it in a let or something?

Best,
Alex

P.S. Midje can be found on Github and Clojars.
https://github.com/marick/Midje

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to