+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 <perg...@gmail.com> wrote:

> On Mon, Dec 22, 2008 at 11:29 AM, Caius Durling <ca...@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
> > ca...@caius.name
> > +44 (0) 7960 268 100
> > http://caius.name/
> >
> > _______________________________________________
> > rspec-users mailing list
> > rspec-users@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@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to