1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00

Auto-lock, Auto-scope all specs, except where not.

This commit is contained in:
Charles Lowell 2012-06-05 08:00:04 -05:00
parent ec1d910b3d
commit 8976cb9fc7
11 changed files with 165 additions and 164 deletions

View file

@ -1,5 +1,4 @@
require 'v8'
load File.expand_path '../c/context_helper.rb', __FILE__
def run_v8_gc
while !V8::C::V8::IdleNotification() do
@ -10,3 +9,26 @@ def rputs(msg)
puts "<pre>#{ERB::Util.h(msg)}</pre>"
$stdout.flush
end
module ExplicitScoper;end
module Autoscope
def instance_eval(*args, &block)
V8::C::Locker() do
V8::C::HandleScope() do
@cxt = V8::C::Context::New()
begin
@cxt.Enter()
super(*args, &block)
ensure
@cxt.Exit()
end
end
end
end
end
RSpec.configure do |c|
c.before(:each) do
extend Autoscope unless is_a? ExplicitScoper
end
end