Sha256: 1e0cad73c41c8dd3c5171b7dbbc9d0d64a661367dd369347b8bbdf9c31d7e66d

Contents?: true

Size: 1.69 KB

Versions: 4

Compression:

Stored size: 1.69 KB

Contents

require 'spec_helper'

describe Mutant::Runner::Subject, '#success?' do
  subject { object.success? }

  let(:object) { described_class.new(config, mutation_subject) }

  let(:mutation_subject) do
    double(
      'Subject',
      class:     Mutant::Subject,
      mutations: [mutation_a, mutation_b]
    )
  end

  let(:reporter)   { Mutant::Reporter::Trace.new                              }
  let(:config)     { double('Config', reporter: reporter, strategy: strategy) }
  let(:mutation_a) { double('Mutation A')                                     }
  let(:mutation_b) { double('Mutation B')                                     }
  let(:strategy)   { double('Strategy')                                       }

  let(:runner_a) do
    double('Runner A', success?: success_a, stop?: stop_a)
  end

  let(:runner_b) do
    double('Runner B', success?: success_b, stop?: stop_b)
  end

  let(:tests) { [double('test a'), double('test b')] }

  before do
    expect(strategy).to receive(:tests).with(mutation_subject).and_return(tests)
    expect(Mutant::Runner).to receive(:run).with(config, mutation_a, tests).and_return(runner_a)
    expect(Mutant::Runner).to receive(:run).with(config, mutation_b, tests).and_return(runner_b)
  end

  context 'with failing mutations' do
    let(:stop_a)    { false }
    let(:stop_b)    { false }
    let(:success_a) { false }
    let(:success_b) { true  }

    it { should be(false) }

    it_should_behave_like 'an idempotent method'
  end

  context 'without failing mutations' do
    let(:stop_a)    { false }
    let(:stop_b)    { false }
    let(:success_a) { true  }
    let(:success_b) { true  }

    it { should be(true) }

    it_should_behave_like 'an idempotent method'
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mutant-0.5.23 spec/unit/mutant/runner/subject_spec.rb
mutant-0.5.22 spec/unit/mutant/runner/subject_spec.rb
mutant-0.5.21 spec/unit/mutant/runner/subject_spec.rb
mutant-0.5.20 spec/unit/mutant/runner/subject_spec.rb