Sha256: 2332ce7e2ab73a01b4a4ad0ef8f3e7b583f8d5ded2edaa8fd85dbd06f6af11a1

Contents?: true

Size: 684 Bytes

Versions: 2

Compression:

Stored size: 684 Bytes

Contents

require 'spec_helper'

describe V8::C::Object do
  include V8::ExtSpec

  it "always returns a copy of the same object if it is the same object" do
    v8_eval('var o = new Object()')
    v8_eval('o').should be(v8_eval('o'))
  end

  it "will return a new peer and not barf if the old peer has been garbage collected" do
    v8_eval('var o = {foo: "bar"}')
    o = v8_eval('o')
    old_id = o.object_id
    ruby_gc do
      o = nil
      v8_eval('o').Get(c::String::New("foo")).Utf8Value().should == "bar"
      v8_eval('o').object_id.should_not be(old_id)
    end
    #can't quite get this to work in 1.8. I'm questioning if it's worth the effort
  end if RUBY_VERSION >= "1.9.2"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
therubyracer-0.9.0beta2 spec/ext/object_spec.rb
therubyracer-0.9.0beta1 spec/ext/object_spec.rb