free_mutant/spec/unit/mutant/runner/mutation/killer_spec.rb

40 lines
874 B
Ruby
Raw Normal View History

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
mock(
2013-06-22 23:24:48 -07:00
'Config',
:reporter => reporter,
2013-04-20 20:50:36 +02:00
:strategy => strategy
)
end
let(:reporter) { mock('Reporter') }
let(:mutation) { mock('Mutation') }
let(:strategy) { mock('Strategy') }
let(:killer) { mock('Killer') }
subject { object.killer }
2013-06-22 23:24:48 -07:00
before do
2013-04-20 20:50:36 +02:00
reporter.stub(:report => reporter)
strategy.stub(:kill => killer)
end
it 'should call configuration to identify strategy' do
2013-03-27 15:52:02 +01:00
config.should_receive(:strategy).with().and_return(strategy)
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