Sha256: 694ffbe45bbb78e50fe278daf5df09ab3e1721c85da67b70728c9aff3ae4c60f

Contents?: true

Size: 388 Bytes

Versions: 8

Compression:

Stored size: 388 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe Hash do
  describe ".[]" do
    it "accepts an Array argument (Ruby 1.8.6 and older)" do
      list = [['foo', 'bar'], ['foo2', 'bar2']]
      expect(Hash[list]).to eq({'foo' => 'bar', 'foo2' => 'bar2'})
    end

    it "accepts an array as a key" do
      expect(Hash[['a', 'b'], 1]).to eq({['a', 'b'] => 1})
    end
  end
end

Version data entries

8 entries across 7 versions & 2 rubygems

Version Path
abaci-0.3.0 vendor/bundle/gems/yard-0.9.2/spec/core_ext/hash_spec.rb
abaci-0.3.0 vendor/bundle/gems/yard-0.9.1/spec/core_ext/hash_spec.rb
yard-0.9.5 spec/core_ext/hash_spec.rb
yard-0.9.4 spec/core_ext/hash_spec.rb
yard-0.9.3 spec/core_ext/hash_spec.rb
yard-0.9.2 spec/core_ext/hash_spec.rb
yard-0.9.1 spec/core_ext/hash_spec.rb
yard-0.9.0 spec/core_ext/hash_spec.rb