free_mutant/spec/unit/mutant/cli_run_spec.rb

49 lines
1.1 KiB
Ruby
Raw Normal View History

# encoding: utf-8
2012-08-28 12:57:39 -04:00
require 'spec_helper'
describe Mutant::CLI, '.run' do
subject { object.run(argv) }
2013-09-08 16:12:23 -04:00
let(:object) { described_class }
let(:argv) { double('ARGV') }
let(:attributes) { double('Options') }
let(:runner) { double('Runner', success?: success) }
let(:config) { double('Config') }
let(:instance) { double(described_class.name, config: config) }
2012-08-28 12:57:39 -04:00
2013-04-17 23:31:21 -04:00
before do
2013-09-08 16:12:23 -04:00
described_class.stub(new: instance)
Mutant::Runner::Config.stub(run: runner)
2012-08-28 12:57:39 -04:00
end
context 'when runner is successful' do
let(:success) { true }
2012-08-28 12:57:39 -04:00
it { should be(0) }
it 'should run with attributes' do
Mutant::Runner::Config
.should_receive(:run)
.with(config)
.and_return(runner)
should be(0)
end
end
context 'when runner fails' do
let(:success) { false }
it { should be(1) }
it 'should run with attributes' do
Mutant::Runner::Config
.should_receive(:run)
.with(config)
.and_return(runner)
should be(1)
end
2012-08-28 12:57:39 -04:00
end
2012-08-28 12:57:39 -04:00
end