Add tests for implications.
This commit is contained in:
parent
16c17433d5
commit
f1bf6c03c3
@ -16,7 +16,7 @@ module Cask
|
|||||||
|
|
||||||
attr_reader :cask, :download
|
attr_reader :cask, :download
|
||||||
|
|
||||||
attr_predicate :appcast?, :new_cask?, :strict?, :online?
|
attr_predicate :appcast?, :new_cask?, :strict?, :online?, :token_conflicts?
|
||||||
|
|
||||||
def initialize(cask, appcast: nil, download: nil, quarantine: nil,
|
def initialize(cask, appcast: nil, download: nil, quarantine: nil,
|
||||||
token_conflicts: nil, online: nil, strict: nil,
|
token_conflicts: nil, online: nil, strict: nil,
|
||||||
@ -355,7 +355,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
|
|
||||||
def check_token_conflicts
|
def check_token_conflicts
|
||||||
return unless @token_conflicts
|
return unless token_conflicts?
|
||||||
return unless core_formula_names.include?(cask.token)
|
return unless core_formula_names.include?(cask.token)
|
||||||
|
|
||||||
add_warning "possible duplicate, cask token conflicts with Homebrew core formula: #{core_formula_url}"
|
add_warning "possible duplicate, cask token conflicts with Homebrew core formula: #{core_formula_url}"
|
||||||
|
|||||||
@ -30,17 +30,52 @@ describe Cask::Audit, :cask do
|
|||||||
end
|
end
|
||||||
|
|
||||||
let(:cask) { instance_double(Cask::Cask) }
|
let(:cask) { instance_double(Cask::Cask) }
|
||||||
let(:download) { false }
|
let(:new_cask) { nil }
|
||||||
let(:token_conflicts) { false }
|
let(:online) { nil }
|
||||||
let(:strict) { false }
|
let(:strict) { nil }
|
||||||
let(:new_cask) { false }
|
let(:token_conflicts) { nil }
|
||||||
let(:audit) {
|
let(:audit) {
|
||||||
described_class.new(cask, download: download,
|
described_class.new(cask, online: online,
|
||||||
token_conflicts: token_conflicts,
|
|
||||||
strict: strict,
|
strict: strict,
|
||||||
new_cask: new_cask)
|
new_cask: new_cask,
|
||||||
|
token_conflicts: token_conflicts)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
describe "#new" do
|
||||||
|
context "when `new_cask` is specified" do
|
||||||
|
let(:new_cask) { true }
|
||||||
|
|
||||||
|
it "implies `online`" do
|
||||||
|
expect(audit).to be_online
|
||||||
|
end
|
||||||
|
|
||||||
|
it "implies `strict`" do
|
||||||
|
expect(audit).to be_strict
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "when `online` is specified" do
|
||||||
|
let(:online) { true }
|
||||||
|
|
||||||
|
it "implies `appcast`" do
|
||||||
|
expect(audit.appcast?).to be true
|
||||||
|
end
|
||||||
|
|
||||||
|
it "implies `download`" do
|
||||||
|
expect(audit.download).to be_truthy
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "when `strict` is specified" do
|
||||||
|
let(:strict) { true }
|
||||||
|
|
||||||
|
it "implies `token_conflicts`" do
|
||||||
|
expect(audit.token_conflicts?).to be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "#result" do
|
describe "#result" do
|
||||||
subject { audit.result }
|
subject { audit.result }
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user