Sha256: f716be4beee2ea1e2c35f9c374bc057ddfb01e1e9f0c550ac67cd3997a2eebce

Contents?: true

Size: 1.67 KB

Versions: 3

Compression:

Stored size: 1.67 KB

Contents

RSpec.describe Mutant::Result::Env do
  let(:object) do
    described_class.new(
      runtime:         double('Runtime'),
      env:             env,
      subject_results: [subject_result]
    )
  end

  let(:env) do
    double(
      'Env',
      config:    config,
      subjects:  [double('Subject')],
      mutations: [double('Mutation')]
    )
  end

  let(:config) do
    double(
      'Config',
      expected_coverage: Rational(1, 1)
    )
  end

  let(:subject_result) do
    double(
      'Subject Result',
      amount_mutation_results: results,
      amount_mutations_killed: killed,
      success?:                true
    )
  end

  let(:results) { 1 }
  let(:killed)  { 0 }

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

    context 'when coverage matches expectation' do
      let(:killed) { 1 }

      it { should be(true) }
    end

    context 'when coverage does not match expectation' do
      it { should be(false) }
    end
  end

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

    it { should eql([]) }
  end

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

    context 'when there are no results' do
      let(:results) { 0 }

      it { should eql(Rational(0)) }
    end

    context 'when there are no kills' do
      it { should eql(Rational(0)) }
    end

    context 'when there are kills' do
      let(:killed)  { 1 }
      let(:results) { 2 }

      it { should eql(Rational(1, 2)) }
    end
  end

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

    it { should eql(1) }
  end

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

    it { should eql(1) }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mutant-0.8.0 spec/unit/mutant/result/env_spec.rb
mutant-0.7.9 spec/unit/mutant/result/env_spec.rb
mutant-0.7.8 spec/unit/mutant/result/env_spec.rb