Sha256: acdd432cdf633a08d82118c405718ec12fbdc30ab8fc06afc23ef0b845ed6229

Contents?: true

Size: 1.44 KB

Versions: 7

Compression:

Stored size: 1.44 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) {
    double(
      'Subject',
      :class     => Mutant::Subject,
      :mutations => [mutation_a, mutation_b]
    )
  }

  let(:reporter)         { double('Reporter')                      }
  let(:config)           { double('Config', :reporter => reporter) }
  let(:mutation_a)       { double('Mutation A')                    }
  let(:mutation_b)       { double('Mutation B')                    }

  let(:runner_a)         { double('Runner A', :success? => success_a, :stop? => stop_a) }
  let(:runner_b)         { double('Runner B', :success? => success_b, :stop? => stop_b) }

  before do
    reporter.stub(:report => reporter)
    Mutant::Runner.stub(:run).with(config, mutation_a).and_return(runner_a)
    Mutant::Runner.stub(:run).with(config, mutation_b).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

7 entries across 7 versions & 1 rubygems

Version Path
mutant-0.3.0.beta21 spec/unit/mutant/runner/subject/success_predicate_spec.rb
mutant-0.3.0.beta20 spec/unit/mutant/runner/subject/success_predicate_spec.rb
mutant-0.3.0.beta19 spec/unit/mutant/runner/subject/success_predicate_spec.rb
mutant-0.3.0.beta18 spec/unit/mutant/runner/subject/success_predicate_spec.rb
mutant-0.3.0.beta17 spec/unit/mutant/runner/subject/success_predicate_spec.rb
mutant-0.3.0.beta16 spec/unit/mutant/runner/subject/success_predicate_spec.rb
mutant-0.3.0.beta15 spec/unit/mutant/runner/subject/success_predicate_spec.rb