2017-03-18 17:02:08 +02:00
|
|
|
require "missing_formula"
|
|
|
|
|
|
|
|
describe Homebrew::MissingFormula do
|
2018-04-14 01:39:00 +02:00
|
|
|
describe "::reason" do
|
2017-03-18 17:02:08 +02:00
|
|
|
subject { described_class.reason("gem") }
|
|
|
|
|
2018-03-25 13:30:37 +01:00
|
|
|
it { is_expected.not_to be_nil }
|
2017-03-18 17:02:08 +02:00
|
|
|
end
|
|
|
|
|
2018-04-14 01:39:00 +02:00
|
|
|
describe "::blacklisted_reason" do
|
|
|
|
matcher :be_blacklisted do
|
2018-03-27 10:58:25 +02:00
|
|
|
match do |expected|
|
|
|
|
described_class.blacklisted_reason(expected)
|
|
|
|
end
|
2017-03-18 17:02:08 +02:00
|
|
|
end
|
|
|
|
|
2018-04-14 01:39:00 +02:00
|
|
|
specify "RubyGems is blacklisted" do
|
|
|
|
expect(%w[gem rubygem rubygems]).to all be_blacklisted
|
2017-03-18 17:02:08 +02:00
|
|
|
end
|
|
|
|
|
2018-04-14 01:39:00 +02:00
|
|
|
specify "LaTeX is blacklisted" do
|
|
|
|
expect(%w[latex tex tex-live texlive TexLive]).to all be_blacklisted
|
2017-03-18 17:02:08 +02:00
|
|
|
end
|
|
|
|
|
2018-04-14 01:39:00 +02:00
|
|
|
specify "pip is blacklisted" do
|
|
|
|
expect("pip").to be_blacklisted
|
2017-03-18 17:02:08 +02:00
|
|
|
end
|
|
|
|
|
2018-04-14 01:39:00 +02:00
|
|
|
specify "PIL is blacklisted" do
|
|
|
|
expect("pil").to be_blacklisted
|
2017-03-18 17:02:08 +02:00
|
|
|
end
|
|
|
|
|
2018-04-14 01:39:00 +02:00
|
|
|
specify "MacRuby is blacklisted" do
|
|
|
|
expect("MacRuby").to be_blacklisted
|
2017-03-18 17:02:08 +02:00
|
|
|
end
|
|
|
|
|
2018-04-14 01:39:00 +02:00
|
|
|
specify "lzma is blacklisted" do
|
|
|
|
expect(%w[lzma liblzma]).to all be_blacklisted
|
2017-03-18 17:02:08 +02:00
|
|
|
end
|
|
|
|
|
2018-04-14 01:39:00 +02:00
|
|
|
specify "gtest is blacklisted" do
|
|
|
|
expect(%w[gtest googletest google-test]).to all be_blacklisted
|
2017-03-18 17:02:08 +02:00
|
|
|
end
|
|
|
|
|
2018-04-14 01:39:00 +02:00
|
|
|
specify "gmock is blacklisted" do
|
|
|
|
expect(%w[gmock googlemock google-mock]).to all be_blacklisted
|
2017-03-18 17:02:08 +02:00
|
|
|
end
|
|
|
|
|
2018-04-14 01:39:00 +02:00
|
|
|
specify "sshpass is blacklisted" do
|
|
|
|
expect("sshpass").to be_blacklisted
|
2017-03-18 17:02:08 +02:00
|
|
|
end
|
|
|
|
|
2018-04-14 01:39:00 +02:00
|
|
|
specify "gsutil is blacklisted" do
|
|
|
|
expect("gsutil").to be_blacklisted
|
2017-03-18 17:02:08 +02:00
|
|
|
end
|
|
|
|
|
2018-04-14 01:39:00 +02:00
|
|
|
specify "gfortran is blacklisted" do
|
|
|
|
expect("gfortran").to be_blacklisted
|
2017-03-18 17:02:08 +02:00
|
|
|
end
|
|
|
|
|
2018-04-14 01:39:00 +02:00
|
|
|
specify "play is blacklisted" do
|
|
|
|
expect("play").to be_blacklisted
|
2017-03-18 17:02:08 +02:00
|
|
|
end
|
|
|
|
|
2018-04-14 01:39:00 +02:00
|
|
|
specify "haskell-platform is blacklisted" do
|
|
|
|
expect("haskell-platform").to be_blacklisted
|
2017-03-18 17:02:08 +02:00
|
|
|
end
|
|
|
|
|
2018-04-14 06:34:46 +02:00
|
|
|
specify "mysqldump-secure is blacklisted" do
|
|
|
|
expect("mysqldump-secure").to be_blacklisted
|
|
|
|
end
|
|
|
|
|
|
|
|
specify "ngrok is blacklisted" do
|
|
|
|
expect("ngrok").to be_blacklisted
|
|
|
|
end
|
|
|
|
|
2018-04-14 01:39:00 +02:00
|
|
|
specify "Xcode is blacklisted", :needs_macos do
|
|
|
|
expect(%w[xcode Xcode]).to all be_blacklisted
|
2017-03-18 17:02:08 +02:00
|
|
|
end
|
|
|
|
end
|
2017-03-20 20:37:12 +01:00
|
|
|
|
2018-04-14 01:39:00 +02:00
|
|
|
describe "::tap_migration_reason" do
|
2017-03-20 20:37:12 +01:00
|
|
|
subject { described_class.tap_migration_reason(formula) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
Tap.clear_cache
|
|
|
|
tap_path = Tap::TAP_DIRECTORY/"homebrew/homebrew-foo"
|
|
|
|
tap_path.mkpath
|
2017-10-15 02:28:32 +02:00
|
|
|
(tap_path/"tap_migrations.json").write <<~EOS
|
2017-03-20 20:37:12 +01:00
|
|
|
{ "migrated-formula": "homebrew/bar" }
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
|
|
|
context "with a migrated formula" do
|
|
|
|
let(:formula) { "migrated-formula" }
|
2018-03-25 13:30:37 +01:00
|
|
|
|
|
|
|
it { is_expected.not_to be_nil }
|
2017-03-20 20:37:12 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
context "with a missing formula" do
|
|
|
|
let(:formula) { "missing-formula" }
|
2018-03-25 13:30:37 +01:00
|
|
|
|
2017-03-20 20:37:12 +01:00
|
|
|
it { is_expected.to be_nil }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-04-14 01:39:00 +02:00
|
|
|
describe "::deleted_reason" do
|
2017-04-22 12:26:18 +01:00
|
|
|
subject { described_class.deleted_reason(formula, silent: true) }
|
2017-03-20 20:37:12 +01:00
|
|
|
|
|
|
|
before do
|
|
|
|
Tap.clear_cache
|
|
|
|
tap_path = Tap::TAP_DIRECTORY/"homebrew/homebrew-foo"
|
|
|
|
tap_path.mkpath
|
|
|
|
(tap_path/"deleted-formula.rb").write "placeholder"
|
2017-12-30 21:18:02 +00:00
|
|
|
ENV.delete "GIT_AUTHOR_DATE"
|
|
|
|
ENV.delete "GIT_COMMITTER_DATE"
|
2017-03-20 20:37:12 +01:00
|
|
|
|
|
|
|
tap_path.cd do
|
2017-07-29 19:55:05 +02:00
|
|
|
system "git", "init"
|
|
|
|
system "git", "add", "--all"
|
|
|
|
system "git", "commit", "-m", "initial state"
|
|
|
|
system "git", "rm", "deleted-formula.rb"
|
|
|
|
system "git", "commit", "-m", "delete formula 'deleted-formula'"
|
2017-03-20 20:37:12 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "with a deleted formula" do
|
|
|
|
let(:formula) { "homebrew/foo/deleted-formula" }
|
2018-03-25 13:30:37 +01:00
|
|
|
|
|
|
|
it { is_expected.not_to be_nil }
|
2017-03-20 20:37:12 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
context "with a formula that never existed" do
|
|
|
|
let(:formula) { "homebrew/foo/missing-formula" }
|
2018-03-25 13:30:37 +01:00
|
|
|
|
2017-03-20 20:37:12 +01:00
|
|
|
it { is_expected.to be_nil }
|
|
|
|
end
|
|
|
|
end
|
2017-03-18 17:02:08 +02:00
|
|
|
end
|