updated the tests, exceptions are raised from the invoke_bundler!

Fixes #2731
This commit is contained in:
Pier-Hugues Pellerin 2015-04-15 09:39:30 -04:00 committed by Jordan Sissel
parent e25ab3ef22
commit f11305752f

View file

@ -57,20 +57,22 @@ describe LogStash::Bundler do
subject
end
it 'should abort if a gem is conflicting' do
allow(::Bundler::CLI).to receive(:start).with(bundler_args) { raise ::Bundler::VersionConflict.new('conflict') }
expect(subject.last).to be_a_kind_of(::Bundler::VersionConflict)
end
context 'abort with an exception' do
it 'gem conflict' do
allow(::Bundler::CLI).to receive(:start).with(bundler_args) { raise ::Bundler::VersionConflict.new('conflict') }
expect { subject }.to raise_error(::Bundler::VersionConflict)
end
it 'should abort if the gem is not found' do
allow(::Bundler::CLI).to receive(:start).with(bundler_args) { raise ::Bundler::GemNotFound.new('conflict') }
expect(subject.last).to be_a_kind_of(::Bundler::GemNotFound)
end
it 'gem is not found' do
allow(::Bundler::CLI).to receive(:start).with(bundler_args) { raise ::Bundler::GemNotFound.new('conflict') }
expect { subject }.to raise_error(::Bundler::GemNotFound)
end
it 'should retry until hitting :max_tries on any other error' do
options.merge!({ :max_tries => 2 })
expect(::Bundler::CLI).to receive(:start).with(bundler_args).at_most(options[:max_tries] + 1) { raise RuntimeError }
subject
it 'on max retries' do
options.merge!({ :max_tries => 2 })
expect(::Bundler::CLI).to receive(:start).with(bundler_args).at_most(options[:max_tries] + 1) { raise RuntimeError }
expect { subject }.to raise_error(RuntimeError)
end
end
end