spec/shoes/swt/spec_helper.rb in shoes-swt-4.0.0.pre4 vs spec/shoes/swt/spec_helper.rb in shoes-swt-4.0.0.pre5

- old
+ new

@@ -11,9 +11,20 @@ allow_any_instance_of(Swt::Widgets::MessageBox).to receive(:open) # stubbed as otherwise all sorts of callbacks are added during certain specs, # which then fail because some doubles are not made for the methods called allow(Shoes::Swt::RedrawingAspect).to receive_messages new: true end + + # https://github.com/jruby/jruby/wiki/Persistence + # mostly to allow stubbing/mocking of said java classes + config.before(:all) do + Swt::Widgets::Shell.__persistent__ = true + Swt::Widgets::MessageBox.__persistent__ = true + Swt::Path.__persistent__ = true + Swt::Transform.__persistent__ = true + Swt::Font.__persistent__ = true + Swt::Widgets::Display.__persistent__ = true + end end # as we do not create real apps most of the time there are no redraws and we # we don't really want that during test execution either way as it adds stuff to # methods that might break