Sha256: 95ebc289ac7f18eb45bc8f19badf316ce4a9c8f1e232aa2f0725dc0b5bb6314f

Contents?: true

Size: 1.29 KB

Versions: 2

Compression:

Stored size: 1.29 KB

Contents

require_relative '../spec_helper'

describe Chicanery::Summary do
  let(:state) { {servers: {} } }

  before do
    state.extend Chicanery::Summary
  end

  describe '#failure?' do
    it 'should be false if there are no jobs' do
      state.should_not have_failure
    end

    it 'should be false if there are no failures' do
      state[:servers][:server1] = {
        job1: { last_build_status: :success },
        job2: { last_build_status: :success }
      }
      state.should_not have_failure
    end

    it 'should be true if there is a single failure' do
      state[:servers][:server1] = {
        job1: { last_build_status: :failure },
        job2: { last_build_status: :success }
      }
      state.should have_failure
    end
  end

  describe '#building?' do
    it 'should be false if there are no jobs' do
      state.should_not be_building
    end

    it 'should be false if all jobs are sleeping' do
      state[:servers][:server1] = {
        job1: { activity: :sleeping },
        job2: { activity: :sleeping }
      }
      state.should_not be_building
    end

    it 'should be true if there is a single job building' do
      state[:servers][:server1] = {
        job1: { activity: :sleeping },
        job2: { activity: :building }
      }
      state.should be_building
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chicanery-0.2.0 spec/chicanery/summary_spec.rb
chicanery-0.1.9 spec/chicanery/summary_spec.rb