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.
|
||||
RESERVED_TAGS = [:build, :optional, :recommended, :run, :test, :linked].freeze
|
||||
|
||||
attr_reader :tags
|
||||
|
||||
def build?
|
||||
tags.include? :build
|
||||
end
|
||||
|
@ -1,5 +0,0 @@
|
||||
# typed: strict
|
||||
|
||||
module Dependable
|
||||
def tags; end
|
||||
end
|
@ -13,7 +13,7 @@ class Dependency
|
||||
include Dependable
|
||||
extend Cachable
|
||||
|
||||
attr_reader :name, :tags, :env_proc, :option_names
|
||||
attr_reader :name, :env_proc, :option_names
|
||||
|
||||
DEFAULT_ENV_PROC = proc {}.freeze
|
||||
private_constant :DEFAULT_ENV_PROC
|
||||
|
@ -17,7 +17,7 @@ class Requirement
|
||||
include Dependable
|
||||
extend Cachable
|
||||
|
||||
attr_reader :tags, :name, :cask, :download
|
||||
attr_reader :name, :cask, :download
|
||||
|
||||
def initialize(tags = [])
|
||||
# Only allow instances of subclasses. This base class enforces no constraints on its own.
|
||||
|
@ -6,9 +6,14 @@ require "dependable"
|
||||
describe Dependable do
|
||||
alias_matcher :be_a_build_dependency, :be_build
|
||||
|
||||
subject(:dependable) { double(tags: tags).extend(described_class) }
|
||||
|
||||
let(:tags) { ["foo", "bar", :build] }
|
||||
subject(:dependable) {
|
||||
Class.new {
|
||||
include Dependable
|
||||
def initialize
|
||||
@tags = ["foo", "bar", :build]
|
||||
end
|
||||
}.new
|
||||
}
|
||||
|
||||
specify "#options" do
|
||||
expect(dependable.options.as_flags.sort).to eq(%w[--foo --bar].sort)
|
||||
|
Loading…
x
Reference in New Issue
Block a user