mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
updated the tests, exceptions are raised from the invoke_bundler!
Fixes #2731
This commit is contained in:
parent
e25ab3ef22
commit
f11305752f
1 changed files with 14 additions and 12 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue