Adding spec for JRUBY-5946

 This  accompanies https://github.com/jruby/jruby/commit/2c8e31014402907549090ca19531bda149ef7e61
Merge pull request #1293 from user454322/master

Adding spec for JRUBY-5946