[rspec-users] Failing to raise an exception in a stub
jarkko at jlaine.net
Fri Sep 14 02:03:55 EDT 2007
On 13.9.2007, at 23.29, aslak hellesoy wrote:
> On 9/13/07, Jarkko Laine <jarkko at jlaine.net> wrote:
>> I've come across rather strange behaviour when trying to raise an
>> exception in a stubbed method.
>> I'm speccing the behaviour of a Rails create action, where I'm using
>> save! to catch failed saves. In the case of working save, I'm using
>> the following stub:
>> which works fine.
>> However, in the negative case,
> Passing a class only works if the new method takes 0 args. Otherwise
> you have to pass an exception instance. ActiveRecord::RecordInvalid
> takes one.
Cheers, that was it!
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2417 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/rspec-users/attachments/20070914/3cfd2a61/attachment.bin
More information about the rspec-users