Sha256: 91817cf2cd9c465f4033417797ffe3dc9f4892e635db1d2420fcdca803b4fca6

Contents?: true

Size: 431 Bytes

Versions: 21

Compression:

Stored size: 431 Bytes

Contents

describe "Enumerable#each_with_object" do
  before :each do
    @values = [2, 5, 3, 6, 1, 4]
    @enum = EnumerableSpecs::Numerous.new(*@values)
    @initial = "memo"
  end

  it "passes each element and its argument to the block" do
    acc = []
    @enum.each_with_object(@initial) do |elem, obj|
      obj.should equal(@initial)
      obj = 42
      acc << elem
    end.should equal(@initial)
    acc.should == @values
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

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