Merge pull request #2060 from reitermarkus/spec-bottle-collector
Convert Utils::Bottles::Collector test to spec.
This commit is contained in:
commit
398de9cf3c
@ -1,27 +0,0 @@
|
||||
require "testing_env"
|
||||
require "utils/bottles"
|
||||
|
||||
class OSMacBottleCollectorTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@collector = Utils::Bottles::Collector.new
|
||||
end
|
||||
|
||||
def checksum_for(tag)
|
||||
@collector.fetch_checksum_for(tag)
|
||||
end
|
||||
|
||||
def test_collector_finds_or_later_tags
|
||||
@collector[:lion_or_later] = "foo"
|
||||
assert_equal ["foo", :lion_or_later], checksum_for(:mountain_lion)
|
||||
assert_nil checksum_for(:snow_leopard)
|
||||
end
|
||||
|
||||
def test_collector_finds_altivec_tags
|
||||
@collector[:tiger_altivec] = "foo"
|
||||
assert_equal ["foo", :tiger_altivec], checksum_for(:tiger_g4)
|
||||
assert_equal ["foo", :tiger_altivec], checksum_for(:tiger_g4e)
|
||||
assert_equal ["foo", :tiger_altivec], checksum_for(:tiger_g5)
|
||||
assert_nil checksum_for(:tiger_g3)
|
||||
end
|
||||
end
|
||||
@ -29,6 +29,11 @@ TEST_DIRECTORIES = [
|
||||
RSpec.configure do |config|
|
||||
config.order = :random
|
||||
config.include(Test::Helper::Shutup)
|
||||
config.before(:each) do |example|
|
||||
if example.metadata[:needs_macos]
|
||||
skip "not on macOS" unless OS.mac?
|
||||
end
|
||||
end
|
||||
config.around(:each) do |example|
|
||||
begin
|
||||
TEST_DIRECTORIES.each(&:mkpath)
|
||||
|
||||
@ -27,5 +27,19 @@ describe Utils::Bottles::Collector do
|
||||
subject[:mountain_lion] = "bar"
|
||||
expect(subject.fetch_checksum_for(:mountain_lion)).to eq(["bar", :mountain_lion])
|
||||
end
|
||||
|
||||
it "finds '_or_later' tags", :needs_macos do
|
||||
subject[:lion_or_later] = "foo"
|
||||
expect(subject.fetch_checksum_for(:mountain_lion)).to eq(["foo", :lion_or_later])
|
||||
expect(subject.fetch_checksum_for(:snow_leopard)).to be nil
|
||||
end
|
||||
|
||||
it "finds '_altivec' tags", :needs_macos do
|
||||
subject[:tiger_altivec] = "foo"
|
||||
expect(subject.fetch_checksum_for(:tiger_g4)).to eq(["foo", :tiger_altivec])
|
||||
expect(subject.fetch_checksum_for(:tiger_g4e)).to eq(["foo", :tiger_altivec])
|
||||
expect(subject.fetch_checksum_for(:tiger_g5)).to eq(["foo", :tiger_altivec])
|
||||
expect(subject.fetch_checksum_for(:tiger_g3)).to be nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user