Sha256: b2bac729c5df8ea00a58839b377863308cb16f01f025081e9f00059451a4d894

Contents?: true

Size: 1.25 KB

Versions: 6

Compression:

Stored size: 1.25 KB

Contents

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

6 entries across 6 versions & 1 rubygems

Version Path
chicanery-0.1.8 spec/chicanery/summary_spec.rb
chicanery-0.1.7 spec/chicanery/summary_spec.rb
chicanery-0.1.6 spec/chicanery/summary_spec.rb
chicanery-0.1.5 spec/chicanery/summary_spec.rb
chicanery-0.1.4 spec/chicanery/summary_spec.rb
chicanery-0.1.3 spec/chicanery/summary_spec.rb