Sha256: 929d181356bd74753bdcd0a2fbe939e6da61c978b7d76e7c1a69dd0933fe8be4

Contents?: true

Size: 1.62 KB

Versions: 5

Compression:

Stored size: 1.62 KB

Contents

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

  let(:env) do
    instance_double(
      Mutant::Env,
      subjects:  [instance_double(Mutant::Subject)],
      mutations: [instance_double(Mutant::Mutation)]
    )
  end

  let(:subject_result) do
    instance_double(
      Mutant::Result::Subject,
      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(1)) }
    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

5 entries across 5 versions & 1 rubygems

Version Path
mutant-0.8.16 spec/unit/mutant/result/env_spec.rb
mutant-0.8.15 spec/unit/mutant/result/env_spec.rb
mutant-0.8.14 spec/unit/mutant/result/env_spec.rb
mutant-0.8.13 spec/unit/mutant/result/env_spec.rb
mutant-0.8.12 spec/unit/mutant/result/env_spec.rb