[rspec-users] newbie cucumber tutorial

Caius Durling caius at caius.name
Mon Dec 22 14:29:07 EST 2008

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.

Caius Durling
caius at caius.name
+44 (0) 7960 268 100

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081222/20baa85b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081222/20baa85b/attachment.bin>

More information about the rspec-users mailing list