Sha256: d8ac8e795719938a96e8a1c8d70a0a3a44f57b25c61093465f61b6abd5859ddb
Contents?: true
Size: 802 Bytes
Versions: 13
Compression:
Stored size: 802 Bytes
Contents
require 'rspec' require 'abstractivator/array_ext' describe Array do describe '#key' do it 'returns the first element' do expect([:k, :v].key).to eql :k end it 'raises an error if the array is not of size 2' do expect{[:k].key}.to raise_error RuntimeError expect{[:k, :v, :z].key}.to raise_error RuntimeError end end describe '#value' do it 'returns the second element' do expect([:k, :v].value).to eql :v end it 'raises an error if the array is not of size 2' do expect{[:k].value}.to raise_error RuntimeError expect{[:k, :v, :z].value}.to raise_error RuntimeError end end describe '#to_h' do it 'makes a hash out of an array of pairs' do expect([[:a, 1], [:b, 2]].to_h).to eql({a: 1, b: 2}) end end end
Version data entries
13 entries across 13 versions & 1 rubygems