Sha256: 082a2efca06d67292ce5034196cfcd412ff199d2315db1165cbae8d2bc2aa7f8

Contents?: true

Size: 852 Bytes

Versions: 11

Compression:

Stored size: 852 Bytes

Contents

require 'helper'

describe 'Olelo::Config' do
  it 'should have #[]= and #[]' do
    config = Olelo::Config.new
    config['a.b.c'] = 42
    config['a.b.c'].should.equal 42
    config['a.b']['c'].should.equal 42
    config['a']['b']['c'].should.equal 42
  end

  it 'should be enumerable' do
    config = Olelo::Config.new
    config['a.x.y'] = 42
    config['b.x.y'] = 43
    config.each do |key, child|
      key.should.be.instance_of String
      child.should.be.instance_of Olelo::Config
      child['x.y'].should.be.instance_of Fixnum
    end
  end

  it 'should freeze' do
    config = Olelo::Config.new
    config['a'] = 42
    config.freeze
    lambda do
      config['a'] += 1
    end.should.raise RuntimeError
  end

  it 'should raise NameError' do
    lambda do
      Olelo::Config.new.not.existing
    end.should.raise NameError
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
olelo-0.9.15 test/config_test.rb
olelo-0.9.14 test/config_test.rb
olelo-0.9.13 test/config_test.rb
olelo-0.9.12 test/config_test.rb
olelo-0.9.11 test/config_test.rb
olelo-0.9.10 test/config_test.rb
olelo-0.9.9 test/config_test.rb
olelo-0.9.8 test/config_test.rb
olelo-0.9.7 test/config_test.rb
olelo-0.9.6 test/config_test.rb
olelo-0.9.5 test/config_test.rb