[rspec-users] Question on SQL exceptions

James Byrne lists at ruby-forum.com
Tue Mar 10 09:20:26 EDT 2009

Pat Maddox wrote:

> Not sure what your problem is.  Here's a gist that demonstrates what
> you're trying to do, and works fine.  http://gist.github.com/76667
> Pat

I do not know what I am doing wrong either.  I tried much the same thing 
as you suggest last night in the console:

>> def my_exception(x=false)
>>   raise ActiveRecord::StatementInvalid if x
>>   puts "No Exception"
>> rescue ActiveRecord::StatementInvalid
>>   puts "exception rescued"
>> end
=> nil
>> my_exception(false)
No Exception
=> nil
>> my_exception(true)
exception rescued
=> nil

So, my version of Ruby has nothing to do with whatever is happening.  I 
will poke at things some more and see if I can discover what my 
misunderstanding is.  It has to be something simple that I just do not 
see at the moment.
Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list