2013-07-28 16:03:06 -07:00
|
|
|
# encoding: utf-8
|
|
|
|
|
2013-02-02 16:32:13 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Mutant::Runner::Mutation, '#killer' do
|
|
|
|
let(:object) { described_class.run(config, mutation) }
|
|
|
|
|
2013-04-20 20:50:36 +02:00
|
|
|
let(:config) do
|
2013-07-14 10:01:30 -07:00
|
|
|
double(
|
2013-06-22 23:24:48 -07:00
|
|
|
'Config',
|
2013-07-15 01:17:15 +02:00
|
|
|
:fail_fast => fail_fast,
|
|
|
|
:reporter => reporter,
|
|
|
|
:strategy => strategy
|
2013-04-20 20:50:36 +02:00
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2013-07-15 01:17:15 +02:00
|
|
|
let(:reporter) { double('Reporter') }
|
|
|
|
let(:mutation) { double('Mutation', :class => Mutant::Mutation) }
|
|
|
|
let(:strategy) { double('Strategy') }
|
|
|
|
let(:killer) { double('Killer', :success? => success) }
|
|
|
|
let(:fail_fast) { false }
|
|
|
|
let(:success) { false }
|
2013-02-02 16:32:13 +01:00
|
|
|
|
|
|
|
subject { object.killer }
|
2013-06-22 23:24:48 -07:00
|
|
|
|
2013-02-02 16:32:13 +01:00
|
|
|
before do
|
2013-04-20 20:50:36 +02:00
|
|
|
reporter.stub(:report => reporter)
|
|
|
|
strategy.stub(:kill => killer)
|
2013-02-02 16:32:13 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'should call configuration to identify strategy' do
|
2013-07-28 12:16:45 -07:00
|
|
|
config.should_receive(:strategy).with(no_args).and_return(strategy)
|
2013-02-02 16:32:13 +01:00
|
|
|
should be(killer)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should run killer' do
|
|
|
|
strategy.should_receive(:kill).with(mutation).and_return(killer)
|
|
|
|
should be(killer)
|
|
|
|
end
|
|
|
|
|
|
|
|
it { should be(killer) }
|
|
|
|
|
|
|
|
it_should_behave_like 'an idempotent method'
|
|
|
|
end
|