Sha256: a0a5fd40c60126d076e2cc9c273de57d894ac7470d4ef5ac04c94feb988514ab

Contents?: true

Size: 299 Bytes

Versions: 23

Compression:

Stored size: 299 Bytes

Contents

describe "Hash#to_a" do
  it "returns a list of [key, value] pairs with same order as each()" do
    h = {:a => 1, 1 => :a, 3 => :b, :b => 5}
    pairs = []

    h.each_pair do |key, value|
      pairs << [key, value]
    end

    h.to_a.should be_kind_of(Array)
    h.to_a.should == pairs
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
opal-0.4.4 spec/rubyspec/core/hash/to_a_spec.rb
opal-0.4.3 spec/rubyspec/core/hash/to_a_spec.rb
opal-0.4.2 spec/rubyspec/core/hash/to_a_spec.rb
opal-0.4.1 spec/rubyspec/core/hash/to_a_spec.rb
opal-0.4.0 spec/rubyspec/core/hash/to_a_spec.rb
opal-0.3.44 spec/rubyspec/core/hash/to_a_spec.rb
opal-0.3.43 spec/rubyspec/core/hash/to_a_spec.rb
opal-0.3.42 spec/core/hash/to_a_spec.rb
opal-0.3.41 spec/core/hash/to_a_spec.rb
opal-0.3.40 spec/core/hash/to_a_spec.rb
opal-0.3.39 spec/core/hash/to_a_spec.rb
opal-0.3.38 spec/core/hash/to_a_spec.rb
opal-0.3.37 spec/core/hash/to_a_spec.rb
opal-0.3.36 spec/core/hash/to_a_spec.rb
opal-0.3.35 spec/core/hash/to_a_spec.rb
opal-0.3.34 spec/core/hash/to_a_spec.rb
opal-0.3.33 spec/core/hash/to_a_spec.rb
opal-0.3.32 spec/core/hash/to_a_spec.rb
opal-0.3.31 spec/core/hash/to_a_spec.rb
opal-0.3.30 spec/core/hash/to_a_spec.rb