Please ignore my previous question - I just realised you're doing Java::java.lang.NullPointerException.new in your second example. I'm seeing the same behaviour and can't think of any way around it off the top of my head.
You could try redefining Java::JavaLang::NullPointerException to be a Ruby RuntimeError within the scope of your spec but I'm not sure how this will work (if at all) when Java::JavaLang::NullPointerException is raised from native code. Best, Sidu. http://c42.in On 23 August 2011 22:59, Sidu Ponnappa <ckponna...@gmail.com> wrote: > it 'adds validation exceptions raised by service to #errors' do > ve = ValidationException #a java exception > ve.stub(:localized_message).and_return('a bunch of errors') > .... > > > Just clarifying, but did you mean > ve = ValidationException.new > > > I tried replicating your spec but with java.lang.RuntimeException > instead of ValidationException and I got > exception class/object expected > > because raise expects an instance of the exception, not the exception > class. Am I missing something? > > Best, > Sidu. > http://c42.in > http://blog.sidu.in > > > > On 23 August 2011 03:20, Lenny Marks <le...@aps.org> wrote: >> service.stub(:validateTaskForSave).and_raise(ve) > _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users