Sha256: 71801438c14e56eda9f965fcdc29614b7d7da5019a8d21991dd408c5de174d21

Contents?: true

Size: 434 Bytes

Versions: 15

Compression:

Stored size: 434 Bytes

Contents

describe "Array#select" do
  it "returns a new array of elements for which block is true" do
    [1, 3, 4, 5, 6, 9].select { |i| i.odd? }.should == [1, 3, 5, 9]
    [1, 2, 3, 4, 5, 6].select { true }.should == [1, 2, 3, 4, 5, 6]
    [1, 2, 3, 4, 5, 6].select { false }.should == []
  end
end

describe "Array#select!" do
  it "returns nil if no changes were made in the array" do
    [1, 2, 3].select! { true }.should be_nil
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
opal-0.3.41 spec/core/array/select_spec.rb
opal-0.3.40 spec/core/array/select_spec.rb
opal-0.3.39 spec/core/array/select_spec.rb
opal-0.3.38 spec/core/array/select_spec.rb
opal-0.3.37 spec/core/array/select_spec.rb
opal-0.3.36 spec/core/array/select_spec.rb
opal-0.3.35 spec/core/array/select_spec.rb
opal-0.3.34 spec/core/array/select_spec.rb
opal-0.3.33 spec/core/array/select_spec.rb
opal-0.3.32 spec/core/array/select_spec.rb
opal-0.3.31 spec/core/array/select_spec.rb
opal-0.3.30 spec/core/array/select_spec.rb
opal-0.3.29 spec/core/array/select_spec.rb
opal-0.3.28 spec/core/array/select_spec.rb
opal-0.3.27 spec/core/array/select_spec.rb