Sha256: b5319a3c721f1e62c56932b6b12f80cb13abb2447d5463653aa38aaee04e8679

Contents?: true

Size: 940 Bytes

Versions: 3

Compression:

Stored size: 940 Bytes

Contents

RSpec.describe ClusterConfig do
  subject(:config) { ClusterConfig.new CLUSTER_CONFIG_PATH }

  describe '.new' do
    context 'node has an existing persisted node name' do
      it 'should use the existing node name' do
        @existing_name = ClusterConfig.new(CLUSTER_CONFIG_PATH).node_name

        expect(config.node_name).to eq @existing_name
      end
    end

    context 'node is being started for the first time' do
      it 'should generate a new node name' do
        expect(config.node_name).to be_a String
      end
    end
  end

  describe '#add_node' do
    it 'should add the node to the nodes hash' do
      config.add_node 'test-node', 'localhost:7000'

      expect(config.nodes['test-node']).to eq 'localhost:7000'
    end

    it 'should persist node list' do
      ClusterConfig.new(CLUSTER_CONFIG_PATH).add_node 'fluffy', 'localhost:80'

      expect(config.nodes['fluffy']).to eq 'localhost:80'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
aggro-0.0.4 spec/lib/aggro/cluster_config_spec.rb
aggro-0.0.3 spec/lib/aggro/cluster_config_spec.rb
aggro-0.0.2 spec/lib/aggro/cluster_config_spec.rb