Sha256: 28ce114a62e2010056053b8ca0c95d1f1b2a63b1508521e2ed8a1ca8c65ea06d

Contents?: true

Size: 959 Bytes

Versions: 3

Compression:

Stored size: 959 Bytes

Contents

require 'spec_helper'

module Falcore
  describe Aggregator do
    let(:endpoint) { 'http://jenkins.local' }
    let(:config)   { Config.new(endpoint: endpoint) }
    let(:computer) { JSON.parse(File.read(File.expand_path('../../fixtures/computer.json', __FILE__))) }

    before do
      Fetcher.stub(:get).and_return(computer)
    end

    subject { Aggregator.new(config) }

    describe '#run' do
      let(:master) { subject.run }

      it 'returns a master jenkins node' do
        expect(master).to be_a(Node::Master)
      end

      it 'adds the slaves to the master' do
        expect(master.slaves.size).to eq(3)
      end

      it 'correctly builds each slave object' do
        expect(master.slaves[0].display_name).to eq('slave1.jenkins.example.com')
        expect(master.slaves[1].display_name).to eq('slave2.jenkins.example.com')
        expect(master.slaves[2].display_name).to eq('slave3.jenkins.example.com')
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
falcore-0.2.0 spec/unit/aggregator_spec.rb
falcore-0.1.1 spec/unit/aggregator_spec.rb
falcore-0.1.0 spec/unit/aggregator_spec.rb