Merge pull request #12980 from danielnachun/add_tag_to_cellar
Add tag_to_cellar method
This commit is contained in:
commit
f0f1eb6d4a
@ -504,14 +504,19 @@ class BottleSpecification
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(tag: Utils::Bottles::Tag).returns(T::Boolean) }
|
sig { params(tag: Utils::Bottles::Tag).returns(T.any(Symbol, String)) }
|
||||||
def compatible_locations?(tag: Utils::Bottles.tag)
|
def tag_to_cellar(tag = Utils::Bottles.tag)
|
||||||
spec = collector.specification_for(tag)
|
spec = collector.specification_for(tag)
|
||||||
cellar = if spec.present?
|
if spec.present?
|
||||||
spec.cellar
|
spec.cellar
|
||||||
else
|
else
|
||||||
tag.default_cellar
|
tag.default_cellar
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
sig { params(tag: Utils::Bottles::Tag).returns(T::Boolean) }
|
||||||
|
def compatible_locations?(tag: Utils::Bottles.tag)
|
||||||
|
cellar = tag_to_cellar(tag)
|
||||||
|
|
||||||
return true if [:any, :any_skip_relocation].include?(cellar)
|
return true if [:any, :any_skip_relocation].include?(cellar)
|
||||||
|
|
||||||
|
|||||||
@ -41,6 +41,18 @@ describe BottleSpecification do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#compatible_locations?" do
|
||||||
|
it "checks if the bottle cellar is relocatable" do
|
||||||
|
expect(bottle_spec.compatible_locations?).to be false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "#tag_to_cellar" do
|
||||||
|
it "returns the cellar for a tag" do
|
||||||
|
expect(bottle_spec.tag_to_cellar).to eq Utils::Bottles.tag.default_cellar
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
%w[root_url rebuild].each do |method|
|
%w[root_url rebuild].each do |method|
|
||||||
specify "##{method}" do
|
specify "##{method}" do
|
||||||
object = Object.new
|
object = Object.new
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user