Add some runner predicate tests
This commit is contained in:
parent
21fdb99801
commit
439b914d14
4 changed files with 52 additions and 6 deletions
|
@ -68,7 +68,7 @@ module Mutant
|
||||||
# @api private
|
# @api private
|
||||||
#
|
#
|
||||||
def run
|
def run
|
||||||
@mutations = subject.map do |mutation|
|
@mutations = subject.mutations.map do |mutation|
|
||||||
Mutation.run(config, mutation)
|
Mutation.run(config, mutation)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,8 +12,10 @@ describe Mutant::Runner::Config, '#success?' do
|
||||||
let(:subject_b) { mock('Subject B', :fails? => false) }
|
let(:subject_b) { mock('Subject B', :fails? => false) }
|
||||||
|
|
||||||
class DummySubjectRunner
|
class DummySubjectRunner
|
||||||
def initialize(_config, subject)
|
include Concord.new(:config, :subject)
|
||||||
@subject = subject
|
|
||||||
|
def self.run(*args)
|
||||||
|
new(*args)
|
||||||
end
|
end
|
||||||
|
|
||||||
def failed?
|
def failed?
|
||||||
|
|
|
@ -5,9 +5,9 @@ describe Mutant::Runner::Subject, '#mutations' do
|
||||||
|
|
||||||
subject { object.mutations }
|
subject { object.mutations }
|
||||||
|
|
||||||
let(:config) { mock('Config') }
|
let(:config) { mock('Config') }
|
||||||
let(:mutation) { mock('Mutation') }
|
let(:mutation) { mock('Mutation') }
|
||||||
let(:mutation_subject) { [mutation] }
|
let(:mutation_subject) { mock('Subject', :mutations => [mutation]) }
|
||||||
|
|
||||||
class DummyRunner
|
class DummyRunner
|
||||||
include Concord.new(:config, :mutation)
|
include Concord.new(:config, :mutation)
|
||||||
|
|
44
spec/unit/mutant/runner/subject/success_predicate_spec.rb
Normal file
44
spec/unit/mutant/runner/subject/success_predicate_spec.rb
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe Mutant::Runner::Subject, '#success?' do
|
||||||
|
subject { object.success? }
|
||||||
|
|
||||||
|
let(:object) { described_class.run(config, mutation_subject) }
|
||||||
|
|
||||||
|
let(:mutation_subject) { mock('Subject', :mutations => mutations) }
|
||||||
|
let(:config) { mock('Config') }
|
||||||
|
let(:mutation_a) { mock('Mutation A', :fails? => false) }
|
||||||
|
let(:mutation_b) { mock('Mutation B', :fails? => false) }
|
||||||
|
let(:mutations) { [mutation_a, mutation_b] }
|
||||||
|
|
||||||
|
class DummyMutationRunner
|
||||||
|
include Concord.new(:config, :mutation)
|
||||||
|
|
||||||
|
def self.run(*args)
|
||||||
|
new(*args)
|
||||||
|
end
|
||||||
|
|
||||||
|
def failed?
|
||||||
|
@mutation.fails?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
before do
|
||||||
|
stub_const('Mutant::Runner::Mutation', DummyMutationRunner)
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'without evil failed mutations' do
|
||||||
|
it { should be(true) }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with failing noop mutation' do
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with failing evil mutations' do
|
||||||
|
before do
|
||||||
|
mutation_a.stub(:fails? => true)
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should be(false) }
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Reference in a new issue