1
0
Fork 0

Handle integration load errors with better message

[fixes ]
This commit is contained in:
Markus Schirp 2014-11-30 23:22:21 +00:00
parent dea853d067
commit 97530771bf
2 changed files with 18 additions and 3 deletions
lib/mutant
spec/unit/mutant

View file

@ -128,6 +128,8 @@ module Mutant
def setup_integration(name)
require "mutant/integration/#{name}"
update(integration: Integration.lookup(name))
rescue LoadError
fail Error, "Could not load integration #{name.inspect} (you may want to try installing the gem mutant-#{name})"
end
# Add options

View file

@ -155,11 +155,24 @@ Options:
end
context 'with use flag' do
let(:flags) { %w[--use rspec] }
context 'when integration exists' do
let(:flags) { %w[--use rspec] }
it_should_behave_like 'a cli parser'
it_should_behave_like 'a cli parser'
let(:expected_integration) { Mutant::Integration::Rspec.build }
let(:expected_integration) { Mutant::Integration::Rspec.build }
end
context 'when integration does NOT exist' do
let(:flags) { %w[--use other] }
it 'raises error' do
expect { subject }.to raise_error(
Mutant::CLI::Error,
'Could not load integration "other" (you may want to try installing the gem mutant-other)'
)
end
end
end
context 'with version flag' do