Sha256: b0006b18f1ea15eb0b2de1a8a4a12952bcec7b5ffcfb9827b3167ed04465ac74

Contents?: true

Size: 1.08 KB

Versions: 8

Compression:

Stored size: 1.08 KB

Contents

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.16 spec/unit/mutant/parallel/source/array_spec.rb
mutant-0.8.15 spec/unit/mutant/parallel/source/array_spec.rb
mutant-0.8.14 spec/unit/mutant/parallel/source/array_spec.rb
mutant-0.8.13 spec/unit/mutant/parallel/source/array_spec.rb
mutant-0.8.12 spec/unit/mutant/parallel/source/array_spec.rb
mutant-0.8.11 spec/unit/mutant/parallel/source/array_spec.rb
mutant-0.8.10 spec/unit/mutant/parallel/source/array_spec.rb
mutant-0.8.9 spec/unit/mutant/parallel/source/array_spec.rb