2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-02-12 21:37:46 +01:00
|
|
|
require "utils/bottles"
|
|
|
|
|
|
|
|
describe Utils::Bottles::Collector do
|
|
|
|
describe "#fetch_checksum_for" do
|
|
|
|
it "returns passed tags" do
|
2019-01-26 17:13:14 +00:00
|
|
|
subject[:yosemite] = "foo"
|
|
|
|
subject[:el_captain] = "bar"
|
|
|
|
expect(subject.fetch_checksum_for(:el_captain)).to eq(["bar", :el_captain])
|
2017-02-12 21:37:46 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
it "returns nil if empty" do
|
|
|
|
expect(subject.fetch_checksum_for(:foo)).to be nil
|
|
|
|
end
|
|
|
|
|
|
|
|
it "returns nil when there is no match" do
|
2019-01-26 17:13:14 +00:00
|
|
|
subject[:yosemite] = "foo"
|
2017-02-12 21:37:46 +01:00
|
|
|
expect(subject.fetch_checksum_for(:foo)).to be nil
|
|
|
|
end
|
|
|
|
|
2019-01-08 19:13:46 +00:00
|
|
|
it "uses older tags when needed", :needs_macos do
|
2019-06-05 19:48:38 -07:00
|
|
|
subject[:mavericks] = "foo"
|
|
|
|
expect(subject.send(:find_matching_tag, :mavericks)).to eq(:mavericks)
|
|
|
|
expect(subject.send(:find_matching_tag, :yosemite)).to eq(:mavericks)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "does not use older tags when requested not to", :needs_macos do
|
2020-04-05 15:44:50 +01:00
|
|
|
allow(Homebrew::EnvConfig).to receive(:developer?).and_return(true)
|
|
|
|
allow(Homebrew::EnvConfig).to receive(:skip_or_later_bottles?).and_return(true)
|
2019-06-05 19:48:38 -07:00
|
|
|
allow(OS::Mac).to receive(:prerelease?).and_return(true)
|
|
|
|
subject[:mavericks] = "foo"
|
|
|
|
expect(subject.send(:find_matching_tag, :mavericks)).to eq(:mavericks)
|
|
|
|
expect(subject.send(:find_matching_tag, :yosemite)).to be_nil
|
|
|
|
end
|
|
|
|
|
|
|
|
it "ignores HOMEBREW_SKIP_OR_LATER_BOTTLES on release versions", :needs_macos do
|
2020-05-23 19:39:11 +01:00
|
|
|
allow(Homebrew::EnvConfig).to receive(:skip_or_later_bottles?).and_return(true)
|
2019-06-05 19:48:38 -07:00
|
|
|
allow(OS::Mac).to receive(:prerelease?).and_return(false)
|
|
|
|
subject[:mavericks] = "foo"
|
|
|
|
expect(subject.send(:find_matching_tag, :mavericks)).to eq(:mavericks)
|
|
|
|
expect(subject.send(:find_matching_tag, :yosemite)).to eq(:mavericks)
|
2017-02-12 21:37:46 +01:00
|
|
|
end
|
2017-02-12 21:37:46 +01:00
|
|
|
end
|
|
|
|
end
|