Sha256: 1d43e4c32a47f992b20b4c9e4d7f0e8146a1120a8e98ada508ebe5ab616a5429

Contents?: true

Size: 803 Bytes

Versions: 10

Compression:

Stored size: 803 Bytes

Contents

class A
end

class B
end

shared_examples_for 'Clazz Registry' do
  let(:hash1) do
    {:a => A, :b => B}
  end

  let(:hash2) do
    {:c => 3}
  end

  describe 'register' do
    before do
      subject.register :a, A
      
    end
    its(:registered) { should include(:a) }
    specify do
      lambda { subject.register :b, 3 }.should raise_error
    end
  end

  describe 'append <<' do
    before do
      subject << hash1
    end
    its(:registered) { should include(*hash1.keys) }
    its(:registered_classes) { should include(*hash1.values) }
    
    specify do
      lambda { subject << hash2 }.should raise_error
    end    
  end

  describe 'set index []=' do
    before do
      subject.clean!
      subject[:a] = B
    end
    its(:registered_classes) { should include(B) }
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
cantango-config-0.2.1 spec/cantango/registry/shared/clazz_ex.rb
cantango-config-0.2.0 spec/cantango/registry/shared/clazz_ex.rb
cantango-config-0.1.9.2 spec/cantango/configuration/shared/registry/clazz_ex.rb
cantango-config-0.1.8.1 spec/cantango/configuration/shared/registry/clazz_ex.rb
cantango-config-0.1.8 spec/cantango/configuration/shared/registry/clazz_ex.rb
cantango-config-0.1.7 spec/cantango/configuration/shared/registry/clazz_ex.rb
cantango-config-0.1.6 spec/cantango/configuration/shared/registry/clazz_ex.rb
cantango-config-0.1.5 spec/cantango/configuration/shared/registry/clazz_ex.rb
cantango-config-0.1.4 spec/cantango/configuration/shared/registry/clazz_ex.rb
cantango-config-0.1.3 spec/cantango/configuration/shared/registry/clazz_ex.rb