Sha256: cfeeffdc2c8d2bf45eef6e3b0f2a2195aef6a32c38d936d2dfa72709344224e8
Contents?: true
Size: 691 Bytes
Versions: 2
Compression:
Stored size: 691 Bytes
Contents
class ArraySubclassSpec < Array def add_val(val) `#{self}.push(val)` self end def foo :bar end end describe "Array subclasses" do it "should have their defined methods present on instances" do ArraySubclassSpec.new.foo.should == :bar end it "should correctly keep their length" do arr = ArraySubclassSpec.new arr.add_val :foo arr.length.should == 1 end it "should have the correct class" do ArraySubclassSpec.new.class.should == ArraySubclassSpec Array.new.class.should == Array end it "is just an instance of the bridged constructor" do arr = ArraySubclassSpec.new `(arr.constructor === Array)`.should == true end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
opal-0.3.22 | spec/opal/array/subclassing_spec.rb |
opal-0.3.21 | test/opal/array/subclassing_spec.rb |