Sha256: 922a91cbcb80e249d3e7c73a0473e469cf9077f35f5888a7b3148877c6023f51

Contents?: true

Size: 365 Bytes

Versions: 3

Compression:

Stored size: 365 Bytes

Contents

describe "Array#clear" do
  it "removes all elements" do
    a = [1, 2, 3, 4]
    a.clear
    # a.clear.should == a
    a.should == []
  end
  
  it "returns self" do
    a = [1]
    oid = a.object_id
    a.clear.object_id.should == oid
  end
  
  it "leaves the Array empty" do
    a = [1]
    a.clear
    a.empty?.should == true
    a.size.should == 0
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
opal-0.2.2 opals/opal/opal/spec/core/array/clear_spec.rb
opal-0.2.0 opals/opal/opal/spec/core/array/clear_spec.rb
opal-0.1.0 opals/opal/spec/core/array/clear_spec.rb