Re: Mocking out namespaces

2011-09-16 Thread Stuart Sierra
Brian Marick wrote Midje to support Clojure testing with a lot of mocking. May be worth a try: https://github.com/marick/Midje -S -- 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

Re: Mocking out namespaces

2011-09-16 Thread Brian Hurt
On Fri, Sep 16, 2011 at 4:01 PM, Stuart Sierra wrote: > On Friday, September 16, 2011 3:12:49 PM UTC-4, Brian Hurt wrote: >> >> How *should* I structure this code for testing? I was assuming the >> natural way to do this is to make A, B, and C separate name spaces but maybe >> this is wrong. > >

Re: Mocking out namespaces

2011-09-16 Thread Brian Hurt
On Fri, Sep 16, 2011 at 4:28 PM, Chris Perkins wrote: > On Friday, September 16, 2011 3:12:49 PM UTC-4, Brian Hurt wrote: >> >> >> >> On Thu, Sep 15, 2011 at 6:42 AM, Chris Perkins wrote: >> >>> On Wednesday, September 14, 2011 11:19:13 AM UTC-4, Brian Hurt wrote: Say I have two name spa

Re: Mocking out namespaces

2011-09-16 Thread Chris Perkins
On Friday, September 16, 2011 3:12:49 PM UTC-4, Brian Hurt wrote: > > > > On Thu, Sep 15, 2011 at 6:42 AM, Chris Perkins wrote: > >> On Wednesday, September 14, 2011 11:19:13 AM UTC-4, Brian Hurt wrote: >>> >>> Say I have two name spaces, A and B, with A depending on B. I want to >>> test namespa

Re: Mocking out namespaces

2011-09-16 Thread Stuart Sierra
On Friday, September 16, 2011 3:12:49 PM UTC-4, Brian Hurt wrote: > > How *should* I structure this code for testing? I was assuming the natural > way to do this is to make A, B, and C separate name spaces but maybe this is > wrong. The best way to make these namespaces testable, in my opinion

Re: Mocking out namespaces

2011-09-16 Thread Brian Hurt
On Thu, Sep 15, 2011 at 6:42 AM, Chris Perkins wrote: > On Wednesday, September 14, 2011 11:19:13 AM UTC-4, Brian Hurt wrote: >> >> Say I have two name spaces, A and B, with A depending on B. I want to >> test namespace A, replacing module B with a mock B for testing purposes- >> preferably witho

Re: Mocking out namespaces

2011-09-15 Thread Chris Perkins
On Wednesday, September 14, 2011 11:19:13 AM UTC-4, Brian Hurt wrote: > > Say I have two name spaces, A and B, with A depending on B. I want to test > namespace A, replacing module B with a mock B for testing purposes- > preferably without having to load B at all (B sucks in a bunch of stuff, >

Re: Mocking out namespaces

2011-09-14 Thread Stuart Sierra
You can't easily prevent the loading of B unless it's in a separate directory that isn't part of your classpath during testing. You could define B-mock to load B and then redefine all the symbols. -S -- You received this message because you are subscribed to the Google Groups "Clojure" group.

Re: Mocking out namespaces

2011-09-14 Thread Jonathan Fischer Friberg
You could call the mock file B_mock.clj then (require '[B-mock :as B]) Jonathan On Wed, Sep 14, 2011 at 5:19 PM, Brian Hurt wrote: > Say I have two name spaces, A and B, with A depending on B. I want to test > namespace A, replacing module B with a mock B for testing purposes- > preferably wi

Mocking out namespaces

2011-09-14 Thread Brian Hurt
Say I have two name spaces, A and B, with A depending on B. I want to test namespace A, replacing module B with a mock B for testing purposes- preferably without having to load B at all (B sucks in a bunch of stuff, like dependencies on databases and external web sites and etc. that I don't want t