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/

Attachment: PGP.sig
Description: This is a digitally signed message part

_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to