cask audit: check for latest
with auto_updates
This commit is contained in:
parent
4ffc8b137b
commit
ba929cd9e1
@ -36,6 +36,7 @@ module Hbc
|
||||
check_untrusted_pkg
|
||||
check_hosting_with_appcast
|
||||
check_latest_with_appcast
|
||||
check_latest_with_auto_updates
|
||||
check_stanza_requires_uninstall
|
||||
self
|
||||
rescue StandardError => e
|
||||
@ -199,6 +200,13 @@ module Hbc
|
||||
add_warning "Casks with an appcast should not use version :latest"
|
||||
end
|
||||
|
||||
def check_latest_with_auto_updates
|
||||
return unless cask.version.latest?
|
||||
return unless cask.auto_updates
|
||||
|
||||
add_warning "Casks with `version :latest` should not use `auto_updates`"
|
||||
end
|
||||
|
||||
def check_hosting_with_appcast
|
||||
return if cask.appcast
|
||||
|
||||
|
@ -413,6 +413,34 @@ describe Hbc::Audit, :cask do
|
||||
end
|
||||
end
|
||||
|
||||
describe "latest with auto_updates checks" do
|
||||
let(:warning_msg) { "Casks with `version :latest` should not use `auto_updates`" }
|
||||
|
||||
context "when the Cask is :latest and does not have auto_updates" do
|
||||
let(:cask_token) { "version-latest" }
|
||||
|
||||
it { is_expected.not_to warn_with(warning_msg) }
|
||||
end
|
||||
|
||||
context "when the Cask is versioned and does not have auto_updates" do
|
||||
let(:cask_token) { "basic-cask" }
|
||||
|
||||
it { is_expected.not_to warn_with(warning_msg) }
|
||||
end
|
||||
|
||||
context "when the Cask is versioned and has auto_updates" do
|
||||
let(:cask_token) { "auto-updates" }
|
||||
|
||||
it { is_expected.not_to warn_with(warning_msg) }
|
||||
end
|
||||
|
||||
context "when the Cask is :latest and has auto_updates" do
|
||||
let(:cask_token) { "latest-with-auto-updates" }
|
||||
|
||||
it { is_expected.to warn_with(warning_msg) }
|
||||
end
|
||||
end
|
||||
|
||||
describe "preferred download URL formats" do
|
||||
let(:warning_msg) { /URL format incorrect/ }
|
||||
|
||||
|
@ -0,0 +1,11 @@
|
||||
cask 'latest-with-auto-updates' do
|
||||
version :latest
|
||||
sha256 :no_check
|
||||
|
||||
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
|
||||
homepage 'http://example.com/latest-with-auto-updates'
|
||||
|
||||
auto_updates true
|
||||
|
||||
app 'Caffeine.app'
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user