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

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/temple-0.8.2/test/test_map.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/temple-0.8.2/test/test_map.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/temple-0.8.2/test/test_map.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/temple-0.8.2/test/test_map.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/temple-0.8.2/test/test_map.rb
temple-0.9.0 test/test_map.rb
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/temple-0.8.0/test/test_map.rb
temple-0.8.2 test/test_map.rb
temple-0.8.1 test/test_map.rb
brakeman-4.3.1 bundle/ruby/2.5.0/gems/temple-0.7.7/test/test_map.rb
brakeman-4.3.0 bundle/ruby/2.5.0/gems/temple-0.7.7/test/test_map.rb
brakeman-4.2.1 bundle/ruby/2.5.0/gems/temple-0.7.7/test/test_map.rb
brakeman-4.2.0 bundle/ruby/2.3.0/gems/temple-0.7.7/test/test_map.rb
brakeman-4.1.1 bundle/ruby/2.3.0/gems/temple-0.7.7/test/test_map.rb
brakeman-4.1.0 bundle/ruby/2.3.0/gems/temple-0.7.7/test/test_map.rb
brakeman-4.0.1 bundle/ruby/2.3.0/gems/temple-0.7.7/test/test_map.rb
brakeman-4.0.1.pre1 bundle/ruby/2.3.0/gems/temple-0.7.7/test/test_map.rb
brakeman-4.0.0 bundle/ruby/2.3.0/gems/temple-0.7.7/test/test_map.rb
brakeman-3.7.2 bundle/ruby/2.3.0/gems/temple-0.7.7/test/test_map.rb
brakeman-3.7.1 bundle/ruby/2.3.0/gems/temple-0.7.7/test/test_map.rb