Sha256: 1348e5991972634f5781f9f740fd375c36e44346150c761deddb342da0d72e55

Contents?: true

Size: 569 Bytes

Versions: 23

Compression:

Stored size: 569 Bytes

Contents

describe "Array#delete" do
  it "removes elements that are #== to object" do
    x = mock('delete')
    def x.==(other) 3 == other end

    a = [1, 2, 3, x, 4, 3, 5, x]
    a.delete mock('not contained')

    a.delete 3
    a.should == [1, 2, 4, 5]
  end

  it "calculates equality correctly for reference values" do
    a = ["foo", "bar", "foo", "quux", "foo"]
    a.delete "foo"
    a.should == ["bar", "quux"]
  end

  it "returns object or nil if no elements match object" do
    [1, 2, 4, 5].delete(1).should == 1
    [1, 2, 4, 5].delete(3).should == nil
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
opal-0.3.41 spec/core/array/delete_spec.rb
opal-0.3.40 spec/core/array/delete_spec.rb
opal-0.3.39 spec/core/array/delete_spec.rb
opal-0.3.38 spec/core/array/delete_spec.rb
opal-0.3.37 spec/core/array/delete_spec.rb
opal-0.3.36 spec/core/array/delete_spec.rb
opal-0.3.35 spec/core/array/delete_spec.rb
opal-0.3.34 spec/core/array/delete_spec.rb
opal-0.3.33 spec/core/array/delete_spec.rb
opal-0.3.32 spec/core/array/delete_spec.rb
opal-0.3.31 spec/core/array/delete_spec.rb
opal-0.3.30 spec/core/array/delete_spec.rb
opal-0.3.29 spec/core/array/delete_spec.rb
opal-0.3.28 spec/core/array/delete_spec.rb
opal-0.3.27 spec/core/array/delete_spec.rb
opal-0.3.26 spec/core/array/delete_spec.rb
opal-0.3.25 spec/core/array/delete_spec.rb
opal-0.3.22 spec/core/array/delete_spec.rb
opal-0.3.21 test/core/array/delete_spec.rb
opal-0.3.20 test/core/array/delete_spec.rb