aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorMarkus Reiter2017-05-19 21:07:25 +0200
committerMarkus Reiter2017-05-22 02:51:16 +0200
commit1714c73b497b44358fa9fc17d05c767996ac6b7f (patch)
treea6b4e6701d255d070850b22ec49204d744aaf90c /Library/Homebrew/test
parenta44d4ce88b6fb3deea8dc41be662583941d5c96d (diff)
downloadbrew-1714c73b497b44358fa9fc17d05c767996ac6b7f.tar.bz2
Refactor `CLI::Audit`.
Diffstat (limited to 'Library/Homebrew/test')
-rw-r--r--Library/Homebrew/test/cask/cli/audit_spec.rb38
1 files changed, 24 insertions, 14 deletions
diff --git a/Library/Homebrew/test/cask/cli/audit_spec.rb b/Library/Homebrew/test/cask/cli/audit_spec.rb
index 007ba1eb3..312a267f8 100644
--- a/Library/Homebrew/test/cask/cli/audit_spec.rb
+++ b/Library/Homebrew/test/cask/cli/audit_spec.rb
@@ -6,54 +6,64 @@ describe Hbc::CLI::Audit, :cask do
it "audits all Casks if no tokens are given" do
allow(Hbc).to receive(:all).and_return([cask, cask])
- expect(auditor).to receive(:audit).twice
+ expect(auditor).to receive(:audit).twice.and_return(true)
- run_audit([], auditor)
+ run_audit
end
it "audits specified Casks if tokens are given" do
cask_token = "nice-app"
expect(Hbc::CaskLoader).to receive(:load).with(cask_token).and_return(cask)
- expect(auditor).to receive(:audit).with(cask, audit_download: false, check_token_conflicts: false)
+ expect(auditor).to receive(:audit)
+ .with(cask, audit_download: false, check_token_conflicts: false)
+ .and_return(true)
- run_audit([cask_token], auditor)
+ run_audit(cask_token)
end
end
describe "rules for downloading a Cask" do
it "does not download the Cask per default" do
allow(Hbc::CaskLoader).to receive(:load).and_return(cask)
- expect(auditor).to receive(:audit).with(cask, audit_download: false, check_token_conflicts: false)
+ expect(auditor).to receive(:audit)
+ .with(cask, audit_download: false, check_token_conflicts: false)
+ .and_return(true)
- run_audit(["casktoken"], auditor)
+ run_audit("casktoken")
end
it "download a Cask if --download flag is set" do
allow(Hbc::CaskLoader).to receive(:load).and_return(cask)
- expect(auditor).to receive(:audit).with(cask, audit_download: true, check_token_conflicts: false)
+ expect(auditor).to receive(:audit)
+ .with(cask, audit_download: true, check_token_conflicts: false)
+ .and_return(true)
- run_audit(["casktoken", "--download"], auditor)
+ run_audit("casktoken", "--download")
end
end
describe "rules for checking token conflicts" do
it "does not check for token conflicts per default" do
allow(Hbc::CaskLoader).to receive(:load).and_return(cask)
- expect(auditor).to receive(:audit).with(cask, audit_download: false, check_token_conflicts: false)
+ expect(auditor).to receive(:audit)
+ .with(cask, audit_download: false, check_token_conflicts: false)
+ .and_return(true)
- run_audit(["casktoken"], auditor)
+ run_audit("casktoken")
end
it "checks for token conflicts if --token-conflicts flag is set" do
allow(Hbc::CaskLoader).to receive(:load).and_return(cask)
- expect(auditor).to receive(:audit).with(cask, audit_download: false, check_token_conflicts: true)
+ expect(auditor).to receive(:audit)
+ .with(cask, audit_download: false, check_token_conflicts: true)
+ .and_return(true)
- run_audit(["casktoken", "--token-conflicts"], auditor)
+ run_audit("casktoken", "--token-conflicts")
end
end
- def run_audit(args, auditor)
- Hbc::CLI::Audit.new(args, auditor).run
+ def run_audit(*args)
+ Hbc::CLI::Audit.new(*args, auditor: auditor).run
end
end