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