Sha256: 4fa6e29c11e7b2cb05e8ce9ecb2271b6720b8371c21e7caffb425bc05ad4144b

Contents?: true

Size: 671 Bytes

Versions: 7

Compression:

Stored size: 671 Bytes

Contents

require_relative '../spec_helper'

describe 'ProtectedConstructor' do

  it 'should throw a NoMethodError exception if attempting to instantiate Klass without using the KlassFactory' do
   lambda { klass = Klass.new(1) }.should raise_error NoMethodError
  end

  it 'should create a Klass object when using the factory' do
    klass = KlassFactory::create(0)
    klass.nil?.should == false
    klass.is_a?(Klass).should == true
  end

  it 'should create a Klass object when using the factory and pass constructor parameters' do
    klass = KlassFactory::create(99)
    klass.nil?.should == false
    klass.is_a?(Klass).should == true
    klass.id.should == 99
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ProtectedConstructor-2.0.0 spec/ProtectedConstructor/protected_constructor_spec.rb
ProtectedConstructor-1.0.5 spec/ProtectedConstructor/protected_constructor_spec.rb
ProtectedConstructor-1.0.4 spec/ProtectedConstructor/protected_constructor_spec.rb
ProtectedConstructor-1.0.3 spec/ProtectedConstructor/protected_constructor_spec.rb
ProtectedConstructor-1.0.2 spec/ProtectedConstructor/protected_constructor_spec.rb
ProtectedConstructor-1.0.1 spec/ProtectedConstructor/protected_constructor_spec.rb
ProtectedConstructor-1.0.0 spec/ProtectedConstructor/protected_constructor_spec.rb