Sha256: 1f060738aaf43c0de194335496d1a29c7371ee84dcb16a16100dd45cf8590479

Contents?: true

Size: 1.07 KB

Versions: 13

Compression:

Stored size: 1.07 KB

Contents

shared_examples_for 'Hash Registry' do
  describe 'default settings' do
    describe 'defaults' do
      before do
        subject.default = hash1
      end

      its(:default) { should include(hash1) }
    end
  end

  describe 'register' do
    before do
      subject.register hash1
      subject.register hash2
    end
    its(:registered) { should include(hash1) }
    its(:registered) { should include(hash2) }
  end

  describe 'append <<' do
    before do
      subject << hash2
      subject.register hash1
      subject << hash2
    end
    its(:registered) { should include(hash1, hash2) }
  end

  describe 'get index []' do
    before do
      subject.register hash1
      subject << hash2
    end
    
    it 'should respond to :symbol keys' do
      subject[:c].should == hash2[:c]
    end

    it "should respond to 'string' keys" do
      subject['c'].should == hash2[:c]
    end
  end

  describe 'set index []=' do
    before do
      subject.clean!
      subject.register hash1
      subject[:d] = hash2[:c]
    end
    specify { subject[:d].should == hash2[:c] }

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
cantango-config-0.2.1 spec/cantango/registry/shared/hash_ex.rb
cantango-config-0.2.0 spec/cantango/registry/shared/hash_ex.rb
cantango-config-0.1.9.2 spec/cantango/configuration/shared/registry/hash_ex.rb
cantango-config-0.1.8.1 spec/cantango/configuration/shared/registry/hash_ex.rb
cantango-config-0.1.8 spec/cantango/configuration/shared/registry/hash_ex.rb
cantango-config-0.1.7 spec/cantango/configuration/shared/registry/hash_ex.rb
cantango-config-0.1.6 spec/cantango/configuration/shared/registry/hash_ex.rb
cantango-config-0.1.5 spec/cantango/configuration/shared/registry/hash_ex.rb
cantango-config-0.1.4 spec/cantango/configuration/shared/registry/hash_ex.rb
cantango-config-0.1.3 spec/cantango/configuration/shared/registry/hash_ex.rb
cantango-config-0.1.2 spec/cantango/configuration/shared/registry/hash_ex.rb
cantango-config-0.1.1 spec/cantango/configuration/shared/registry/hash_ex.rb
cantango-config-0.1.0 spec/cantango/configuration/shared/hash_registry_ex.rb