Skip to content

Commit

Permalink
Merge pull request #258 from mauro-oto/non-zero-exit-on-argument-error
Browse files Browse the repository at this point in the history
Use non-zero exit code if there's an argument error when running through CLI
  • Loading branch information
postmodern authored Jun 19, 2020
2 parents 77014bb + 0f8fb4f commit 4d10767
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/bundler/audit/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ def print_advisory(gem, advisory)
say
end

def self.exit_on_failure?
true
end

end
end
end
13 changes: 13 additions & 0 deletions spec/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
require 'bundler/audit/cli'

describe Bundler::Audit::CLI do
describe "#start" do
context "with wrong arguments" do
it "exits with error status code" do
expect {
described_class.start ["check", "--ignore CVE-2015-9284"]
}.to raise_error(SystemExit) do |error|
expect(error.success?).to eq(false)
expect(error.status).to eq(1)
end
end
end
end

describe "#update" do
context "not --quiet (the default)" do
context "when update succeeds" do
Expand Down

0 comments on commit 4d10767

Please sign in to comment.