mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Resolve dependable_spec violation
This commit is contained in:
parent
ea832538f7
commit
89c7117b30
@ -11,6 +11,8 @@ module Dependable
|
|||||||
# misuse in future.
|
# misuse in future.
|
||||||
RESERVED_TAGS = [:build, :optional, :recommended, :run, :test, :linked].freeze
|
RESERVED_TAGS = [:build, :optional, :recommended, :run, :test, :linked].freeze
|
||||||
|
|
||||||
|
attr_reader :tags
|
||||||
|
|
||||||
def build?
|
def build?
|
||||||
tags.include? :build
|
tags.include? :build
|
||||||
end
|
end
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
# typed: strict
|
|
||||||
|
|
||||||
module Dependable
|
|
||||||
def tags; end
|
|
||||||
end
|
|
@ -13,7 +13,7 @@ class Dependency
|
|||||||
include Dependable
|
include Dependable
|
||||||
extend Cachable
|
extend Cachable
|
||||||
|
|
||||||
attr_reader :name, :tags, :env_proc, :option_names
|
attr_reader :name, :env_proc, :option_names
|
||||||
|
|
||||||
DEFAULT_ENV_PROC = proc {}.freeze
|
DEFAULT_ENV_PROC = proc {}.freeze
|
||||||
private_constant :DEFAULT_ENV_PROC
|
private_constant :DEFAULT_ENV_PROC
|
||||||
|
@ -17,7 +17,7 @@ class Requirement
|
|||||||
include Dependable
|
include Dependable
|
||||||
extend Cachable
|
extend Cachable
|
||||||
|
|
||||||
attr_reader :tags, :name, :cask, :download
|
attr_reader :name, :cask, :download
|
||||||
|
|
||||||
def initialize(tags = [])
|
def initialize(tags = [])
|
||||||
# Only allow instances of subclasses. This base class enforces no constraints on its own.
|
# Only allow instances of subclasses. This base class enforces no constraints on its own.
|
||||||
|
@ -6,9 +6,14 @@ require "dependable"
|
|||||||
describe Dependable do
|
describe Dependable do
|
||||||
alias_matcher :be_a_build_dependency, :be_build
|
alias_matcher :be_a_build_dependency, :be_build
|
||||||
|
|
||||||
subject(:dependable) { double(tags: tags).extend(described_class) }
|
subject(:dependable) {
|
||||||
|
Class.new {
|
||||||
let(:tags) { ["foo", "bar", :build] }
|
include Dependable
|
||||||
|
def initialize
|
||||||
|
@tags = ["foo", "bar", :build]
|
||||||
|
end
|
||||||
|
}.new
|
||||||
|
}
|
||||||
|
|
||||||
specify "#options" do
|
specify "#options" do
|
||||||
expect(dependable.options.as_flags.sort).to eq(%w[--foo --bar].sort)
|
expect(dependable.options.as_flags.sort).to eq(%w[--foo --bar].sort)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user