Sha256: 47bac68069885e40140a6861e59ad64ba00e848f8886f5bb29c2e55e9006a90b
Contents?: true
Size: 934 Bytes
Versions: 44
Compression:
Stored size: 934 Bytes
Contents
require 'helper' describe Temple::ImmutableMap do it 'has read accessor' do hash = Temple::ImmutableMap.new({a: 1},{b: 2, a: 3}) hash[:a].should.equal 1 hash[:b].should.equal 2 end it 'has include?' do hash = Temple::ImmutableMap.new({a: 1},{b: 2, a: 3}) hash.should.include :a hash.should.include :b hash.should.not.include :c end it 'has values' do Temple::ImmutableMap.new({a: 1},{b: 2, a: 3}).values.sort.should.equal [1,2] end it 'has keys' do Temple::ImmutableMap.new({a: 1},{b: 2, a: 3}).keys.should.equal [:a,:b] end it 'has to_a' do Temple::ImmutableMap.new({a: 1},{b: 2, a: 3}).to_a.should.equal [[:a, 1], [:b, 2]] end end describe Temple::MutableMap do it 'has write accessor' do parent = {a: 1} hash = Temple::MutableMap.new(parent) hash[:a].should.equal 1 hash[:a] = 2 hash[:a].should.equal 2 parent[:a].should.equal 1 end end
Version data entries
44 entries across 44 versions & 6 rubygems