Re: [rspec-users] [JRuby] simulating a java exception in a spec

2011-08-23 Thread Lenny Marks
> > On Aug 22, 2011, at 5:50 PM, Lenny Marks wrote: > >> JRuby 1.6.2 >> rspec-core (2.6.4) >> rspec-expectations (2.6.0) >> rspec-mocks (2.6.0) >> rspec-rails (2.6.1) >> >> I'm sure this has more to do with the way JRuby wraps Java exceptions but I >> figured I'd post here in case anyone here h

Re: [rspec-users] [JRuby] simulating a java exception in a spec

2011-08-23 Thread Sidu Ponnappa
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 R

Re: [rspec-users] [JRuby] simulating a java exception in a spec

2011-08-23 Thread Sidu Ponnappa
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 jav

[rspec-users] [JRuby] simulating a java exception in a spec

2011-08-22 Thread Lenny Marks
JRuby 1.6.2 rspec-core (2.6.4) rspec-expectations (2.6.0) rspec-mocks (2.6.0) rspec-rails (2.6.1) I'm sure this has more to do with the way JRuby wraps Java exceptions but I figured I'd post here in case anyone here has any insight or pointers. In the context of writing a spec for a model like t