[rspec-users] My very fist spec file (not sure what's wrong..)

Ben Mabey ben at benmabey.com
Tue Jul 21 21:55:00 EDT 2009

internetchris wrote:
> I have one additional question after thinking about this for a while.
> Forgive me if I'm about to read this in the book, It came to mind so I
> thought I would ask. When writing specs for controllers am I always
> going to mock the model? Are controllers always isolated from the
> actual model? If that's the case then using cucumber with webrat is
> the only time I will test the complete stack right? Just wondering if
> I understand this correctly.

When I am using Cucumber and writing controller specs that is always how 
*I* do it.  I like having the isolation for the controllers and keeping 
them fast.  Any integration problems will be exposed by Cucumber so I 
think having the controller specs test more that the controller is a 
waste in most cases.  This is just my opinion however.  People on this 
list will agree with me and disagree, so don't think that it is *the* 
way of doing things.  This is what the book recommends IIRC so you are 
understanding it.


> Thanks
> Chris
> On Jul 21, 9:25 am, internetchris <ch... at silhouettesolutions.net>
> wrote:
>> Ben that worked perfectly I appreciate the help.
>> Stephen, I appreciate the encouragement, it feels daunting to be
>> learning all of this at once, but each day I bite off a little more
>> understanding.  It's funny you mention scuba diving - "way back when"
>> right out of high school I thought it would be fun to go to school for
>> underwater construction/welding - so I did. I suppose if I was able to
>> tackle that, I will eventually get this. I'm thankful I decided to
>> switch my degree path to computer science after that however. It was
>> an interesting part of my life to say the least. Maybe it's a
>> personality quirk of mine :-)
>> Thanks!
>> Chris
>> On Jul 20, 9:59 pm, Stephen Eley <sfe... at gmail.com> wrote:
>>> On Mon, Jul 20, 2009 at 11:05 PM, Chris
>>> Sund<ch... at silhouettesolutions.net> wrote:
>>>> I am finally to the point in the rspec book where it describes how to
>>>> implement controller specs, so I thought what the heck, I'll give it a
>>>> try.
>>> Heh.  Points to you for ambition!  You might not have realized this
>>> (because the RSpec book makes it sound like it should *all* be easy)
>>> but starting with a Rails controller spec for your very first spec is
>>> a bit like saying "I was thinking of getting scuba certified...
>>> Ooooh, CAVE DIVING!  Let's start with that first!"*
>>> On the upside, if you start there and really get to *understand*
>>> what's going on, you should be relieved when most of the rest of it is
>>> pretty smooth sailing.  There are very few common Ruby idioms that
>>> have such tight coupling as Rails controllers, so very few tasks are
>>> so hard to spec in isolation.  You'll almost never have to mock
>>> anything else as ferociously.  Model specs in particular will feel
>>> like sunshine and puppies.
>>> So go you!
>>> --
>>> Have Fun,  *(Granted, I don't think anyone has ever kicked up silt
>>> while writing a controller spec, lost hold of their guide line, gotten
>>> hopelessly lost, and died many hours later in the cold and dark.  Yet.
>>>  That only happens to J2EE programmers.)
>>>    Steve Eley (sfe... at gmail.com)
>>>    ESCAPE POD - The Science Fiction Podcast Magazine
>>>    http://www.escapepod.org
>>> _______________________________________________
>>> rspec-users mailing list
>>> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users
>> _______________________________________________
>> rspec-users mailing list
>> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list