Refactor MissingFormula spec.
This commit is contained in:
parent
5e2d4d52ba
commit
16fb563d49
@ -88,3 +88,7 @@ Style/HashSyntax:
|
||||
# so many of these in formulae but none in here
|
||||
Style/TrailingBodyOnMethodDefinition:
|
||||
Enabled: true
|
||||
|
||||
Rspec/ExpectActual:
|
||||
Exclude:
|
||||
- 'test/missing_formula_spec.rb'
|
||||
|
||||
@ -60,7 +60,7 @@ module Homebrew
|
||||
rescue FormulaUnavailableError => e
|
||||
ofail e.message
|
||||
# No formula with this name, try a missing formula lookup
|
||||
if (reason = Homebrew::MissingFormula.reason(f))
|
||||
if (reason = MissingFormula.reason(f))
|
||||
$stderr.puts reason
|
||||
end
|
||||
end
|
||||
|
||||
@ -257,7 +257,7 @@ module Homebrew
|
||||
end
|
||||
|
||||
ofail e.message
|
||||
if (reason = Homebrew::MissingFormula.reason(e.name))
|
||||
if (reason = MissingFormula.reason(e.name))
|
||||
$stderr.puts reason
|
||||
return
|
||||
end
|
||||
|
||||
@ -64,7 +64,7 @@ module Homebrew
|
||||
count = local_results.length + tap_results.length
|
||||
|
||||
ohai "Searching blacklisted, migrated and deleted formulae..."
|
||||
if reason = Homebrew::MissingFormula.reason(query, silent: true)
|
||||
if reason = MissingFormula.reason(query, silent: true)
|
||||
if count.positive?
|
||||
puts
|
||||
puts "If you meant #{query.inspect} specifically:"
|
||||
|
||||
@ -308,7 +308,7 @@ class FormulaAuditor
|
||||
|
||||
name = formula.name
|
||||
|
||||
if Homebrew::MissingFormula.blacklisted_reason(name)
|
||||
if MissingFormula.blacklisted_reason(name)
|
||||
problem "'#{name}' is blacklisted."
|
||||
end
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ module Homebrew
|
||||
# Don't allow blacklisted formula, or names that shadow aliases,
|
||||
# unless --force is specified.
|
||||
unless ARGV.force?
|
||||
if reason = Homebrew::MissingFormula.blacklisted_reason(fc.name)
|
||||
if reason = MissingFormula.blacklisted_reason(fc.name)
|
||||
raise "#{fc.name} is blacklisted for creation.\n#{reason}\nIf you really want to create this formula use --force."
|
||||
end
|
||||
|
||||
|
||||
@ -1,117 +1,77 @@
|
||||
require "missing_formula"
|
||||
|
||||
describe Homebrew::MissingFormula do
|
||||
context "::reason" do
|
||||
describe "::reason" do
|
||||
subject { described_class.reason("gem") }
|
||||
|
||||
it { is_expected.not_to be_nil }
|
||||
end
|
||||
|
||||
context "::blacklisted_reason" do
|
||||
matcher(:be_blacklisted) do
|
||||
describe "::blacklisted_reason" do
|
||||
matcher :be_blacklisted do
|
||||
match do |expected|
|
||||
described_class.blacklisted_reason(expected)
|
||||
end
|
||||
end
|
||||
|
||||
context "rubygems" do
|
||||
%w[gem rubygem rubygems].each do |s|
|
||||
subject { s }
|
||||
|
||||
it { is_expected.to be_blacklisted }
|
||||
end
|
||||
specify "RubyGems is blacklisted" do
|
||||
expect(%w[gem rubygem rubygems]).to all be_blacklisted
|
||||
end
|
||||
|
||||
context "latex" do
|
||||
%w[latex tex tex-live texlive TexLive].each do |s|
|
||||
subject { s }
|
||||
|
||||
it { is_expected.to be_blacklisted }
|
||||
end
|
||||
specify "LaTeX is blacklisted" do
|
||||
expect(%w[latex tex tex-live texlive TexLive]).to all be_blacklisted
|
||||
end
|
||||
|
||||
context "pip" do
|
||||
subject { "pip" }
|
||||
|
||||
it { is_expected.to be_blacklisted }
|
||||
specify "pip is blacklisted" do
|
||||
expect("pip").to be_blacklisted
|
||||
end
|
||||
|
||||
context "pil" do
|
||||
subject { "pil" }
|
||||
|
||||
it { is_expected.to be_blacklisted }
|
||||
specify "PIL is blacklisted" do
|
||||
expect("pil").to be_blacklisted
|
||||
end
|
||||
|
||||
context "macruby" do
|
||||
subject { "MacRuby" }
|
||||
|
||||
it { is_expected.to be_blacklisted }
|
||||
specify "MacRuby is blacklisted" do
|
||||
expect("MacRuby").to be_blacklisted
|
||||
end
|
||||
|
||||
context "lzma" do
|
||||
%w[lzma liblzma].each do |s|
|
||||
subject { s }
|
||||
|
||||
it { is_expected.to be_blacklisted }
|
||||
end
|
||||
specify "lzma is blacklisted" do
|
||||
expect(%w[lzma liblzma]).to all be_blacklisted
|
||||
end
|
||||
|
||||
context "gtest" do
|
||||
%w[gtest googletest google-test].each do |s|
|
||||
subject { s }
|
||||
|
||||
it { is_expected.to be_blacklisted }
|
||||
end
|
||||
specify "gtest is blacklisted" do
|
||||
expect(%w[gtest googletest google-test]).to all be_blacklisted
|
||||
end
|
||||
|
||||
context "gmock" do
|
||||
%w[gmock googlemock google-mock].each do |s|
|
||||
subject { s }
|
||||
|
||||
it { is_expected.to be_blacklisted }
|
||||
end
|
||||
specify "gmock is blacklisted" do
|
||||
expect(%w[gmock googlemock google-mock]).to all be_blacklisted
|
||||
end
|
||||
|
||||
context "sshpass" do
|
||||
subject { "sshpass" }
|
||||
|
||||
it { is_expected.to be_blacklisted }
|
||||
specify "sshpass is blacklisted" do
|
||||
expect("sshpass").to be_blacklisted
|
||||
end
|
||||
|
||||
context "gsutil" do
|
||||
subject { "gsutil" }
|
||||
|
||||
it { is_expected.to be_blacklisted }
|
||||
specify "gsutil is blacklisted" do
|
||||
expect("gsutil").to be_blacklisted
|
||||
end
|
||||
|
||||
context "gfortran" do
|
||||
subject { "gfortran" }
|
||||
|
||||
it { is_expected.to be_blacklisted }
|
||||
specify "gfortran is blacklisted" do
|
||||
expect("gfortran").to be_blacklisted
|
||||
end
|
||||
|
||||
context "play" do
|
||||
subject { "play" }
|
||||
|
||||
it { is_expected.to be_blacklisted }
|
||||
specify "play is blacklisted" do
|
||||
expect("play").to be_blacklisted
|
||||
end
|
||||
|
||||
context "haskell-platform" do
|
||||
subject { "haskell-platform" }
|
||||
|
||||
it { is_expected.to be_blacklisted }
|
||||
specify "haskell-platform is blacklisted" do
|
||||
expect("haskell-platform").to be_blacklisted
|
||||
end
|
||||
|
||||
context "xcode", :needs_macos do
|
||||
%w[xcode Xcode].each do |s|
|
||||
subject { s }
|
||||
|
||||
it { is_expected.to be_blacklisted }
|
||||
end
|
||||
specify "Xcode is blacklisted", :needs_macos do
|
||||
expect(%w[xcode Xcode]).to all be_blacklisted
|
||||
end
|
||||
end
|
||||
|
||||
context "::tap_migration_reason" do
|
||||
describe "::tap_migration_reason" do
|
||||
subject { described_class.tap_migration_reason(formula) }
|
||||
|
||||
before do
|
||||
@ -136,7 +96,7 @@ describe Homebrew::MissingFormula do
|
||||
end
|
||||
end
|
||||
|
||||
context "::deleted_reason" do
|
||||
describe "::deleted_reason" do
|
||||
subject { described_class.deleted_reason(formula, silent: true) }
|
||||
|
||||
before do
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user