This is exactly the sort of purpose I wrote c.c.mock for.  It is
essentially a glorified binding, but it should fit the bill.

(expect [sms-func (times once (has-args [message recipient]))]
  (code-under-test))

This can tie into clojure.test as well if you are using that.

On Sep 28, 3:50 am, Mark Derricutt <m...@talios.com> wrote:
> From what I've seen of fixtures that just provides setup/teardown
> functionality (unless I'm mistaken).
>
> In my particular instance, I'm wanting to stub out a function defined
> elsewhere.  The function wraps an SMS sending service so I really won't want
> to get text messages when running tests.  In Java I'd just have an interface
> with two implementations, and bootstrap the tests with a different
> implementation, in clojure I guess I'd do something like:
>
> (in-ns `some.thing)
> (defn foo [] nil)
>
> or something?
>
> --
> Pull me down under...
>
> On Mon, Sep 28, 2009 at 2:18 PM, John Harrop <jharrop...@gmail.com> wrote:
> > Isn't (binding [foo bar] ...) already such a mechanism? Or does the
> > "fixtures" feature let you specify such a binding for a whole group of tests
> > obviating the need to repeat the binding form in multiple test functions,
> > and perhaps let mutable state carry forward through multiple tests instead
> > of being rebound (and thus reset) after each one?
>
> > (And why does the gmail interface seem designed to encourage users to
> > top-post?)
--~--~---------~--~----~------------~-------~--~----~
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