Sha256: 35ac3ac01ea56c26c45c6fdf20f5f56a2abf4c287f0560923f83725481d8356c

Contents?: true

Size: 1.11 KB

Versions: 8

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

RSpec.describe Mutant::Parallel::Source::Array do
  let(:object) { described_class.new(jobs) }

  let(:job_a) { instance_double(Mutant::Parallel::Job) }
  let(:job_b) { instance_double(Mutant::Parallel::Job) }
  let(:job_c) { instance_double(Mutant::Parallel::Job) }

  let(:jobs) { [job_a, job_b, job_c] }

  describe '#next' do
    subject { object.next }

    context 'when there is a next job' do
      it 'returns that job' do
        should be(job_a)
      end

      it 'does not return the same job twice' do
        expect(object.next).to be(job_a)
        expect(object.next).to be(job_b)
        expect(object.next).to be(job_c)
      end
    end

    context 'when there is no next job' do
      let(:jobs) { [] }

      it 'raises error' do
        expect { subject }.to raise_error(Mutant::Parallel::Source::NoJobError)
      end
    end
  end

  describe '#next?' do
    subject { object.next? }

    context 'when there is a next job' do
      it { should be(true) }
    end

    context 'when there is no next job' do
      let(:jobs) { [] }

      it { should be(false) }
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mutant-0.8.24 spec/unit/mutant/parallel/source/array_spec.rb
mutant-0.8.23 spec/unit/mutant/parallel/source/array_spec.rb
mutant-0.8.22 spec/unit/mutant/parallel/source/array_spec.rb
mutant-0.8.21 spec/unit/mutant/parallel/source/array_spec.rb
mutant-0.8.20 spec/unit/mutant/parallel/source/array_spec.rb
mutant-0.8.19 spec/unit/mutant/parallel/source/array_spec.rb
mutant-0.8.18 spec/unit/mutant/parallel/source/array_spec.rb
mutant-0.8.17 spec/unit/mutant/parallel/source/array_spec.rb