Sha256: d8204f6cdfc0ec78c813c156fbde9f009883b0c6dcee22cfb4a58e3ee1c2feee

Contents?: true

Size: 564 Bytes

Versions: 11

Compression:

Stored size: 564 Bytes

Contents

require 'helper'

class Base
  extend Olelo::Factory
end

class A < Base
end

class B < Base
end

describe 'Olelo::Factory' do
  it 'should have #register' do
    Base.registry.should.be.empty
    Base.register :a, A
    Base.registry[:a].should.equal nil
    Base.registry['a'].should.equal A
    Base.register :b, B
    Base.registry['b'].should.equal B
    lambda { Base.register :a, A }.should.raise ArgumentError
  end

  it 'should have #[]' do
    Base[:a].should.equal A
    Base[:b].should.equal B
    lambda { Base[:c] }.should.raise NameError
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

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