Sha256: bceb281fa8889597888349e71cbf7ef06b898426cd8875e582ff996642d43975

Contents?: true

Size: 807 Bytes

Versions: 3

Compression:

Stored size: 807 Bytes

Contents

class A
end

class B
end

shared_examples_for 'Candidate 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

3 entries across 3 versions & 1 rubygems

Version Path
cantango-config-0.1.2 spec/cantango/configuration/shared/registry/candidate_ex.rb
cantango-config-0.1.1 spec/cantango/configuration/shared/registry/candidate_ex.rb
cantango-config-0.1.0 spec/cantango/configuration/shared/candidate_registry_ex.rb