From c986cedd84722e5cee3f6b20ff1fdecb6ed8e1e1 Mon Sep 17 00:00:00 2001 From: Markus Schirp Date: Sun, 6 Jul 2014 22:33:08 +0000 Subject: [PATCH] Add specificatin for Mutant::CLI.run under exceptions --- spec/unit/mutant/cli_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/unit/mutant/cli_spec.rb b/spec/unit/mutant/cli_spec.rb index 109d5aac..539e77c6 100644 --- a/spec/unit/mutant/cli_spec.rb +++ b/spec/unit/mutant/cli_spec.rb @@ -45,6 +45,20 @@ describe Mutant::CLI do expect(subject).to be(1) end end + + context 'when execution raises an Mutant::CLI::Error' do + let(:exception) { Mutant::CLI::Error.new('test-error') } + let(:report_success) { nil } + + before do + expect(report).to receive(:success?).and_raise(exception) + end + + it 'exits failure' do + expect($stderr).to receive(:puts).with('test-error') + expect(subject).to be(1) + end + end end describe '.new' do