brew/Library/Homebrew/test/missing_formula_spec.rb

140 lines
3.4 KiB
Ruby
Raw Normal View History

require "missing_formula"
describe Homebrew::MissingFormula do
2018-04-14 01:39:00 +02:00
describe "::reason" do
subject { described_class.reason("gem") }
it { is_expected.not_to be_nil }
end
2018-04-14 01:39:00 +02:00
describe "::blacklisted_reason" do
matcher :be_blacklisted do
match do |expected|
described_class.blacklisted_reason(expected)
end
end
2018-04-14 01:39:00 +02:00
specify "RubyGems is blacklisted" do
expect(%w[gem rubygem rubygems]).to all be_blacklisted
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
end
2018-04-14 01:39:00 +02:00
specify "pip is blacklisted" do
expect("pip").to be_blacklisted
end
2018-04-14 01:39:00 +02:00
specify "PIL is blacklisted" do
expect("pil").to be_blacklisted
end
2018-04-14 01:39:00 +02:00
specify "MacRuby is blacklisted" do
expect("MacRuby").to be_blacklisted
end
2018-04-14 01:39:00 +02:00
specify "lzma is blacklisted" do
expect(%w[lzma liblzma]).to all be_blacklisted
end
2018-04-14 01:39:00 +02:00
specify "gtest is blacklisted" do
expect(%w[gtest googletest google-test]).to all be_blacklisted
end
2018-04-14 01:39:00 +02:00
specify "gmock is blacklisted" do
expect(%w[gmock googlemock google-mock]).to all be_blacklisted
end
2018-04-14 01:39:00 +02:00
specify "sshpass is blacklisted" do
expect("sshpass").to be_blacklisted
end
2018-04-14 01:39:00 +02:00
specify "gsutil is blacklisted" do
expect("gsutil").to be_blacklisted
end
2018-04-14 01:39:00 +02:00
specify "gfortran is blacklisted" do
expect("gfortran").to be_blacklisted
end
2018-04-14 01:39:00 +02:00
specify "play is blacklisted" do
expect("play").to be_blacklisted
end
2018-04-14 01:39:00 +02:00
specify "haskell-platform is blacklisted" do
expect("haskell-platform").to be_blacklisted
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
end
end
2018-04-14 01:39:00 +02:00
describe "::tap_migration_reason" do
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
{ "migrated-formula": "homebrew/bar" }
EOS
end
context "with a migrated formula" do
let(:formula) { "migrated-formula" }
it { is_expected.not_to be_nil }
end
context "with a missing formula" do
let(:formula) { "missing-formula" }
it { is_expected.to be_nil }
end
end
2018-04-14 01:39:00 +02:00
describe "::deleted_reason" do
subject { described_class.deleted_reason(formula, silent: true) }
before do
Tap.clear_cache
tap_path = Tap::TAP_DIRECTORY/"homebrew/homebrew-foo"
tap_path.mkpath
(tap_path/"deleted-formula.rb").write "placeholder"
ENV.delete "GIT_AUTHOR_DATE"
ENV.delete "GIT_COMMITTER_DATE"
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'"
end
end
context "with a deleted formula" do
let(:formula) { "homebrew/foo/deleted-formula" }
it { is_expected.not_to be_nil }
end
context "with a formula that never existed" do
let(:formula) { "homebrew/foo/missing-formula" }
it { is_expected.to be_nil }
end
end
end