Skip to content

Commit 4d10767

Browse files
authored
Merge pull request #258 from mauro-oto/non-zero-exit-on-argument-error
Use non-zero exit code if there's an argument error when running through CLI
2 parents 77014bb + 0f8fb4f commit 4d10767

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

lib/bundler/audit/cli.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ def print_advisory(gem, advisory)
156156
say
157157
end
158158

159+
def self.exit_on_failure?
160+
true
161+
end
162+
159163
end
160164
end
161165
end

spec/cli_spec.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22
require 'bundler/audit/cli'
33

44
describe Bundler::Audit::CLI do
5+
describe "#start" do
6+
context "with wrong arguments" do
7+
it "exits with error status code" do
8+
expect {
9+
described_class.start ["check", "--ignore CVE-2015-9284"]
10+
}.to raise_error(SystemExit) do |error|
11+
expect(error.success?).to eq(false)
12+
expect(error.status).to eq(1)
13+
end
14+
end
15+
end
16+
end
17+
518
describe "#update" do
619
context "not --quiet (the default)" do
720
context "when update succeeds" do

0 commit comments

Comments
 (0)