Skip to content

Commit

Permalink
updated the tests, exceptions are raised from the invoke_bundler!
Browse files Browse the repository at this point in the history
  • Loading branch information
ph authored and jordansissel committed Apr 15, 2015
1 parent 8b2a6b0 commit 26c5a5f
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions spec/lib/logstash/bundler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,22 @@
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

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
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 '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

Expand Down

0 comments on commit 26c5a5f

Please sign in to comment.