rubyjs / therubyracer

Embed the V8 Javascript Interpreter into Ruby
1.66k stars 191 forks source link

Fix segmentation fault in tests #333

Closed georgyangelov closed 9 years ago

georgyangelov commented 9 years ago

This fixes segmentation faults in the tests as extending the examples in a before block with override of #instance_eval seems to not work. This causes V8 to segfault since the tests try to instantiate objects without a context.

Also, the context wrap is now opt-in with a helper method, instead of being opt-out and relying on #described_class (which has slightly different behavior in RSpec 3). This has the added benefit of clarity since the creation of the context wasn't apparent when looking at the examples.

Tested on Ruby 2.1.5 and RSpec 2.99.2. Let me know if you have any comments. :)