free_mutant/spec/unit/mutant/runner/config/success_predicate_spec.rb

44 lines
1.1 KiB
Ruby
Raw Normal View History

2013-03-27 15:52:02 +01:00
require 'spec_helper'
describe Mutant::Runner::Config, '#success?' do
subject { object.success? }
let(:object) { described_class.run(config) }
let(:config) { mock('Config', :strategy => strategy, :subjects => subjects) }
let(:strategy) { mock('Strategy') }
let(:subjects) { [subject_a, subject_b] }
let(:subject_a) { mock('Subject A', :fails? => false) }
let(:subject_b) { mock('Subject B', :fails? => false) }
class DummySubjectRunner
2013-04-12 23:34:27 +02:00
include Concord.new(:config, :subject)
def self.run(*args)
new(*args)
2013-03-27 15:52:02 +01:00
end
def failed?
@subject.fails?
end
end
before do
stub_const('Mutant::Runner::Subject', DummySubjectRunner)
strategy.stub(:setup)
strategy.stub(:teardown)
end
context 'without failed subjects' do
it { should be(true) }
end
context 'with failing subjects' do
before do
subject_a.stub(:fails? => true)
end
it { should be(false) }
end
end