Re: Getting strange behavior when stubbing

2010-12-12 Thread Brian Marick
On Dec 11, 2010, at 12:16 AM, ka wrote: > Hi Brian, > > Can you explain this in more detail : > >>> I didn't have the laziness problem. I don't know if that was by accident or >>> because Midje applies an #'eagerly function before checking. > > Because it seems that if code has a laziness prob

Re: Getting strange behavior when stubbing

2010-12-11 Thread Alex Baranosky
You're right Ken. I had written a macro to wrap the clojure.test stuff, and wasn't able to put both the actual and expected inside the stubbing. If I had just been using Amit Rathore's stuff with standard clojure.test then I'd have had no problem! -- You received this message because you are su

Re: Getting strange behavior when stubbing

2010-12-10 Thread Ken Wesson
On Sat, Dec 11, 2010 at 1:16 AM, ka wrote: > Hi Brian, > > Can you explain this in more detail : > >>> I didn't have the laziness problem. I don't know if that was by accident or >>> because Midje applies an #'eagerly function before checking. > > Because it seems that if code has a laziness prob

Re: Getting strange behavior when stubbing

2010-12-10 Thread ka
Hi Brian, Can you explain this in more detail : >> I didn't have the laziness problem. I don't know if that was by accident or >> because Midje applies an #'eagerly function before checking. Because it seems that if code has a laziness problem, Midje will actually hide it in tests? Thanks. --

Re: Getting strange behavior when stubbing

2010-12-10 Thread Alex Baranosky
Hey Brian, I just got your latest version of Midje via lein, and I'm able to use it. I had been getting a stack trace previously. Midje is nice, because I can do more specialized stubbing with it than with the code I got from Amit Rathore's blog/book. Also, this is the fmap I wrote (with the li

Re: Getting strange behavior when stubbing

2010-12-10 Thread Brian Marick
Shameless Self-promotion Dept: Here's how I'd write your three tests in Midje. https://github.com/marick/Midje (fact "chains of locations are handled" (distances "Boston,MA" "Albany,NY" "LosAngeles,CA") => [2.0, 2.0] (provided (dist-in-miles anything anything) => 2.0)) (fact "can convert dist

Re: Getting strange behavior when stubbing

2010-12-09 Thread Ken Wesson
On Thu, Dec 9, 2010 at 11:35 PM, Alex Baranosky wrote: > Thanks Ken. You're welcome. -- 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 - pleas

Re: Getting strange behavior when stubbing

2010-12-09 Thread Alex Baranosky
Thanks Ken. (doall) to the rescue! It worked! Makes perfect sense. It explains why sometimes it would seem to work if I put the result of the mapping into a let binding... it was calculating the value. -- You received this message because you are subscribed to the Google Groups "Clojure" gro

Re: Getting strange behavior when stubbing

2010-12-09 Thread Ken Wesson
On Thu, Dec 9, 2010 at 10:50 PM, Alex Baranosky wrote: >   (map (fn [dest] (dist-in-miles origin dest)) locations)) > It seems the stubbing is not happening when (distances "Boston,MA" > "Albany,NY" "LosAngeles,CA") is being evaluated.  But if I put print > statements in the function to see the

Getting strange behavior when stubbing

2010-12-09 Thread Alex Baranosky
I've been playing with Amit Rathore's simple mocking functions: http://s-expressions.com/2010/01/24/conjure-simple-mocking-and-stubbing-for-clojure-unit-tests/ I'm seeing the weirdest effect, and after banging my head on it for a couple hours I figure it's time to ask about it. Any ideas would be