[rspec-users] Question on SQL exceptions
lists at ruby-forum.com
Mon Mar 9 16:00:19 EDT 2009
James Byrne wrote:
> To prevent duplicate values in the DBMS I use a unique index on those
> columns. I am testing that duplicate values cannot, in fact, be added.
> I thought, probably incorrectly, that when #save is called then any
> errors are returned to the controller to handle. This is evidently not
> happening so can someone tell me how this is supposed to be handled?
A. rescue ActiveRecord::StatementInvalid
Posted via http://www.ruby-forum.com/.
More information about the rspec-users