Add specs for Mutant::CLI.run

This commit is contained in:
Markus Schirp 2014-07-06 22:30:39 +00:00
parent f9b0edf697
commit 290b92c6a7

View file

@ -15,6 +15,38 @@ shared_examples_for 'a cli parser' do
end
describe Mutant::CLI do
let(:object) { described_class }
describe '.run' do
subject { object.run(arguments) }
let(:arguments) { double('arguments') }
let(:report) { double('Report', success?: report_success) }
let(:config) { double('Config') }
before do
expect(Mutant::CLI).to receive(:call).with(arguments).and_return(config)
expect(Mutant::Env).to receive(:call).with(config).and_return(report)
end
context 'when report signalls success' do
let(:report_success) { true }
it 'exits failure' do
expect(subject).to be(0)
end
end
context 'when report signalls error' do
let(:report_success) { false }
it 'exits failure' do
expect(subject).to be(1)
end
end
end
describe '.new' do
let(:object) { described_class }