Rename fetch_bottle_for to fetch_checksum_for
This commit is contained in:
parent
68326805ae
commit
33eed80ccc
@ -68,7 +68,7 @@ class BottleCollector
|
|||||||
@bottles = {}
|
@bottles = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch_bottle_for(tag)
|
def fetch_checksum_for(tag)
|
||||||
return [@bottles[tag], tag] if @bottles[tag]
|
return [@bottles[tag], tag] if @bottles[tag]
|
||||||
|
|
||||||
find_altivec_tag(tag) || find_or_later_tag(tag)
|
find_altivec_tag(tag) || find_or_later_tag(tag)
|
||||||
|
|||||||
@ -164,7 +164,7 @@ class BottleSpecification
|
|||||||
end
|
end
|
||||||
|
|
||||||
def tag?(tag)
|
def tag?(tag)
|
||||||
!!collector.fetch_bottle_for(tag)
|
!!checksum_for(tag)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Checksum methods in the DSL's bottle block optionally take
|
# Checksum methods in the DSL's bottle block optionally take
|
||||||
@ -177,7 +177,7 @@ class BottleSpecification
|
|||||||
end
|
end
|
||||||
|
|
||||||
def checksum_for(tag)
|
def checksum_for(tag)
|
||||||
collector.fetch_bottle_for(tag)
|
collector.fetch_checksum_for(tag)
|
||||||
end
|
end
|
||||||
|
|
||||||
def checksums
|
def checksums
|
||||||
|
|||||||
@ -6,33 +6,37 @@ class BottleCollectorTests < Homebrew::TestCase
|
|||||||
@collector = BottleCollector.new
|
@collector = BottleCollector.new
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def checksum_for(tag)
|
||||||
|
@collector.fetch_checksum_for(tag)
|
||||||
|
end
|
||||||
|
|
||||||
def test_collector_returns_passed_tags
|
def test_collector_returns_passed_tags
|
||||||
@collector[:lion] = "foo"
|
@collector[:lion] = "foo"
|
||||||
@collector[:mountain_lion] = "bar"
|
@collector[:mountain_lion] = "bar"
|
||||||
assert_equal ['bar', :mountain_lion], @collector.fetch_bottle_for(:mountain_lion)
|
assert_equal ['bar', :mountain_lion], checksum_for(:mountain_lion)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_collector_returns_nil_on_no_matches
|
def test_collector_returns_nil_on_no_matches
|
||||||
assert_nil @collector.fetch_bottle_for(:foo)
|
assert_nil checksum_for(:foo)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_collector_finds_or_later_tags
|
def test_collector_finds_or_later_tags
|
||||||
@collector[:lion_or_later] = "foo"
|
@collector[:lion_or_later] = "foo"
|
||||||
assert_equal ['foo', :lion_or_later], @collector.fetch_bottle_for(:mountain_lion)
|
assert_equal ['foo', :lion_or_later], checksum_for(:mountain_lion)
|
||||||
assert_nil @collector.fetch_bottle_for(:snow_leopard)
|
assert_nil checksum_for(:snow_leopard)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_collector_prefers_exact_matches
|
def test_collector_prefers_exact_matches
|
||||||
@collector[:lion_or_later] = "foo"
|
@collector[:lion_or_later] = "foo"
|
||||||
@collector[:mountain_lion] = "bar"
|
@collector[:mountain_lion] = "bar"
|
||||||
assert_equal ['bar', :mountain_lion], @collector.fetch_bottle_for(:mountain_lion)
|
assert_equal ['bar', :mountain_lion], checksum_for(:mountain_lion)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_collector_finds_altivec_tags
|
def test_collector_finds_altivec_tags
|
||||||
@collector[:tiger_altivec] = "foo"
|
@collector[:tiger_altivec] = "foo"
|
||||||
assert_equal ['foo', :tiger_altivec], @collector.fetch_bottle_for(:tiger_g4)
|
assert_equal ['foo', :tiger_altivec], checksum_for(:tiger_g4)
|
||||||
assert_equal ['foo', :tiger_altivec], @collector.fetch_bottle_for(:tiger_g4e)
|
assert_equal ['foo', :tiger_altivec], checksum_for(:tiger_g4e)
|
||||||
assert_equal ['foo', :tiger_altivec], @collector.fetch_bottle_for(:tiger_g5)
|
assert_equal ['foo', :tiger_altivec], checksum_for(:tiger_g5)
|
||||||
assert_nil @collector.fetch_bottle_for(:tiger_g3)
|
assert_nil checksum_for(:tiger_g3)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user