[rspec-users] newbie cucumber tutorial

Steve Molitor stevemolitor at gmail.com
Mon Dec 22 17:51:27 EST 2008


+1 @ Pat

I was going to respond in more detail, but I do exactly what Pat does --
bang in steps, no bang in Rails apps.  The Rails scaffolding boiler plate
generates no bangs.
Steve

On Mon, Dec 22, 2008 at 2:30 PM, Pat Maddox <pergesu at gmail.com> wrote:

> On Mon, Dec 22, 2008 at 11:29 AM, Caius Durling <caius at caius.name> wrote:
> >
> > On 22 Dec 2008, at 17:18, aslak hellesoy wrote:
> >
> > Essentially, #create will never raise an error no matter what you pass
> it,
> > and you actually want exceptions for bad input in your tests (step
> > definitions).
> > Therefore - use #create! (or #save!). In your app, use the non-bang
> methods.
> >
> > Use the bang methods everywhere, but make sure to catch
> > ActiveRecord::RecordInvalid and ActiveRecord::RecordNotFound either in
> > rescue_from handlers or within the controller actions themselves.
> > If you use rescue_from you need to turn on rails_error_handling in
> rspec's
> > config though.
> > C
> > ---
> > Caius Durling
> > caius at caius.name
> > +44 (0) 7960 268 100
> > http://caius.name/
> >
> > _______________________________________________
> > rspec-users mailing list
> > rspec-users at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/rspec-users
> >
>
> I'm a "use the non-bang methods in the app, bang methods in tests"
> guy.  In the app, I don't want an exception to be raised, because
> validation failures aren't exceptional.  if @post.save is good enough
> to know what happened.  In tests though, I want it to fail fast and
> noisily, so I use bang methods.
>
> Pat
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081222/849b2237/attachment.html>


More information about the rspec-users mailing list