[rspec-users] Slides from "Uses & Abuses of Mocks & Stubs" at NWRUG
pat.maddox at gmail.com
Wed Oct 21 04:46:32 EDT 2009
Response written as I go through the slides, and late at night under
sleep deprivation ;)
* 57 juicy slides in half an hour? Damn dude.
* Not a fan of the "defining an interface" service example. A single
method named #query that accepts a string that appears to have the
real command is not much of an interface. What about something like
service.should_receive(:store).with(:first_name => 'Fred', :last_name
=> 'Flintstone') ?
* I dig the be_equivalent_xml_to matcher
* On the Simulating Situations slide I would stub the call to #save
instead of expecting it. You're just setting up context for the
example to run in.
* may be a style thing but in your Degrees of Freedom shapes examples
I don't like creating the shapes in a before. Just inline it
* the shape example where you pass in a mock is really weird to me.
What are you trying to illustrate? A different example might be more
effective (or I just need to hear the commentary that goes with that
Over all it looks like a great introduction to the benefits, use, and
pitfalls of mocks. Thanks for sharing.
On Sat, Oct 17, 2009 at 12:54 PM, Ashley Moran
<ashley.moran at patchspace.co.uk> wrote:
> Hi all
> I gave a presentation on mock objects this week at the North West Ruby User
> Group in Manchester. I thought some of you may be interested in the
> slides, which are now on my blog.
> Note that most of the slides were prepared late at night under sleep
> deprivation, so there are a few bits where I had to clear up what I meant in
> response to questions. (Mainly, by using examples that are so trivial it's
> not clear what the benefit of a mock object is.) But hopefully there's
> enough value in them that non-attendees might find them useful.
> Feedback gratefully received.
>  http://nwrug.org/events/october09/
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users