Skip to content

Commit

Permalink
Merge pull request #20 from shopsmart/bugfix/audit-default
Browse files Browse the repository at this point in the history
Bugfix/audit default
  • Loading branch information
wenga86 authored Dec 12, 2018
2 parents 84fc176 + 75cb0e3 commit 908eff1
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
bd_lint (0.4.0)
bd_lint (0.4.1)
brakeman
bundler-audit
execjs
Expand Down
2 changes: 1 addition & 1 deletion lib/bd_lint/audit/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class CLI < Bundler::Audit::CLI
def check
if ENV["DISABLE_BUNDLE_AUDIT"]
DISABLED_WARNING.each { |msg| say msg, :yellow }
exit 0
return
end

super
Expand Down
2 changes: 1 addition & 1 deletion lib/bd_lint/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module BdLint
VERSION = "0.4.0".freeze
VERSION = "0.4.1".freeze
end
5 changes: 3 additions & 2 deletions lib/tasks/bd_lint.rake
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ namespace :bd_lint do
BdLint::Audit::CLI.start [command]
end
end

task default: "bd_lint:audit"
rescue LoadError
puts "Bundle Audit Gem not loaded. Nothing to do"
end
Expand All @@ -39,3 +37,6 @@ namespace :bd_lint do
end
end
end

# Make audit a default task if defined
task default: "bd_lint:audit" if Rake::Task.task_defined?("bd_lint:audit")
12 changes: 9 additions & 3 deletions spec/lib/tasks/bd_lint_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
describe "bd_lint:audit" do
include_context "rake"

let(:default_task) { Rake::Task.tasks.find { |t| t.name.eql?("default") } }

it "calls update" do
expect_any_instance_of(BdLint::Audit::CLI).to receive(:update)
subject.invoke
Expand All @@ -34,9 +36,13 @@
end

it "scans Gemfile.lock" do
expect_any_instance_of(Bundler::Audit::Scanner).to receive(:scan).and_call_original
subject.invoke
end
expect_any_instance_of(Bundler::Audit::Scanner).to receive(:scan).and_call_original
subject.invoke
end

it "is part of the default rake tasks" do
expect(default_task.prerequisite_tasks.map(&:name)).to include "bd_lint:audit"
end

context "when the DISABLE_BUNDLE_AUDIT is set" do
before do
Expand Down
2 changes: 1 addition & 1 deletion test_app/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
bd_lint (0.3.0)
bd_lint (0.4.1)
brakeman
bundler-audit
execjs
Expand Down

0 comments on commit 908eff1

Please sign in to comment.