1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00
therubyracer/spec/c/array_spec.rb
Georgy Angelov 654b808ac5 Use #around for creation of context for C examples
This fixes segmentation fault in the tests as extending the examples in a before block with override of `#instance_eval` seems to not work.

Also, the context wrap is now opt-in with a helper method, instead of opt-out and relying on `#described_class` (which has slightly different behavior in RSpec 3).

Tested on Ruby 2.1.5 and RSpec 2.99.2.
2015-03-15 18:27:19 +00:00

19 lines
396 B
Ruby

require 'spec_helper'
describe V8::C::Array do
requires_v8_context
it "can store and retrieve a value" do
o = V8::C::Object::New()
a = V8::C::Array::New()
a.Length().should eql 0
a.Set(0, o)
a.Length().should eql 1
a.Get(0).Equals(o).should be_true
end
it "can be initialized with a length" do
a = V8::C::Array::New(5)
a.Length().should eql 5
end
end