Fix (auto-correct) RuboCop RSpec/BeNil offenses

This commit is contained in:
Issy Long 2022-03-01 00:01:13 +00:00
parent da6650348f
commit 6b76fd012a
No known key found for this signature in database
GPG Key ID: 8247C390DADC67D4
28 changed files with 108 additions and 108 deletions

View File

@ -11,7 +11,7 @@ describe "ENV" do
it "supports switching compilers" do it "supports switching compilers" do
subject.clang subject.clang
expect(subject["LD"]).to be nil expect(subject["LD"]).to be_nil
expect(subject["CC"]).to eq(subject["OBJC"]) expect(subject["CC"]).to eq(subject["OBJC"])
end end
@ -23,7 +23,7 @@ describe "ENV" do
subject["foo"] = "bar" subject["foo"] = "bar"
end end
expect(subject["foo"]).to be nil expect(subject["foo"]).to be_nil
expect(subject).to eq(before) expect(subject).to eq(before)
end end
@ -37,7 +37,7 @@ describe "ENV" do
end end
}.to raise_error(StandardError) }.to raise_error(StandardError)
expect(subject["foo"]).to be nil expect(subject["foo"]).to be_nil
expect(subject).to eq(before) expect(subject).to eq(before)
end end
@ -139,7 +139,7 @@ describe "ENV" do
subject["MAKEFLAGS"] = "-j4" subject["MAKEFLAGS"] = "-j4"
subject.deparallelize do subject.deparallelize do
expect(subject["MAKEFLAGS"]).to be nil expect(subject["MAKEFLAGS"]).to be_nil
end end
expect(subject["MAKEFLAGS"]).to eq("-j4") expect(subject["MAKEFLAGS"]).to eq("-j4")

View File

@ -125,7 +125,7 @@ describe PATH do
end end
it "returns nil instead of an empty #{described_class}" do it "returns nil instead of an empty #{described_class}" do
expect(described_class.new.existing).to be nil expect(described_class.new.existing).to be_nil
end end
end end
end end

View File

@ -342,7 +342,7 @@ describe Cask::DSL, :cask do
let(:token) { "with-depends-on-formula" } let(:token) { "with-depends-on-formula" }
it "allows depends_on formula to be specified" do it "allows depends_on formula to be specified" do
expect(cask.depends_on.formula).not_to be nil expect(cask.depends_on.formula).not_to be_nil
end end
end end
@ -350,7 +350,7 @@ describe Cask::DSL, :cask do
let(:token) { "with-depends-on-formula-multiple" } let(:token) { "with-depends-on-formula-multiple" }
it "allows multiple depends_on formula to be specified" do it "allows multiple depends_on formula to be specified" do
expect(cask.depends_on.formula).not_to be nil expect(cask.depends_on.formula).not_to be_nil
end end
end end
end end
@ -360,7 +360,7 @@ describe Cask::DSL, :cask do
let(:token) { "with-depends-on-cask" } let(:token) { "with-depends-on-cask" }
it "is allowed" do it "is allowed" do
expect(cask.depends_on.cask).not_to be nil expect(cask.depends_on.cask).not_to be_nil
end end
end end
@ -368,7 +368,7 @@ describe Cask::DSL, :cask do
let(:token) { "with-depends-on-cask-multiple" } let(:token) { "with-depends-on-cask-multiple" }
it "is allowed" do it "is allowed" do
expect(cask.depends_on.cask).not_to be nil expect(cask.depends_on.cask).not_to be_nil
end end
end end
end end
@ -396,7 +396,7 @@ describe Cask::DSL, :cask do
let(:token) { "with-depends-on-arch" } let(:token) { "with-depends-on-arch" }
it "is allowed to be specified" do it "is allowed to be specified" do
expect(cask.depends_on.arch).not_to be nil expect(cask.depends_on.arch).not_to be_nil
end end
end end

View File

@ -41,7 +41,7 @@ describe Homebrew::CLI::Parser do
it "does not set the positive name if the positive flag is not passed" do it "does not set the positive name if the positive flag is not passed" do
args = parser.parse([]) args = parser.parse([])
expect(args.positive?).to be nil expect(args.positive?).to be_nil
end end
end end

View File

@ -70,7 +70,7 @@ describe Commands do
specify "returns the path for an internal command" do specify "returns the path for an internal command" do
expect(described_class.path("rbcmd")).to eq(HOMEBREW_LIBRARY_PATH/"cmd/rbcmd.rb") expect(described_class.path("rbcmd")).to eq(HOMEBREW_LIBRARY_PATH/"cmd/rbcmd.rb")
expect(described_class.path("shcmd")).to eq(HOMEBREW_LIBRARY_PATH/"cmd/shcmd.sh") expect(described_class.path("shcmd")).to eq(HOMEBREW_LIBRARY_PATH/"cmd/shcmd.sh")
expect(described_class.path("idontexist1234")).to be nil expect(described_class.path("idontexist1234")).to be_nil
end end
specify "returns the path for an internal developer-command" do specify "returns the path for an internal developer-command" do

View File

@ -65,7 +65,7 @@ describe DependencyCollector do
it "creates a resource dependency from a '.gz' URL" do it "creates a resource dependency from a '.gz' URL" do
resource = Resource.new resource = Resource.new
resource.url("https://brew.sh/foo.tar.gz") resource.url("https://brew.sh/foo.tar.gz")
expect(collector.add(resource)).to be nil expect(collector.add(resource)).to be_nil
end end
it "creates a resource dependency from a '.lz' URL" do it "creates a resource dependency from a '.lz' URL" do

View File

@ -46,7 +46,7 @@ module Homebrew
expect(ft).to have_trailing_newline expect(ft).to have_trailing_newline
expect(ft =~ /\burl\b/).to be_truthy expect(ft =~ /\burl\b/).to be_truthy
expect(ft.line_number(/desc/)).to be nil expect(ft.line_number(/desc/)).to be_nil
expect(ft.line_number(/\burl\b/)).to eq(2) expect(ft.line_number(/\burl\b/)).to eq(2)
expect(ft).to include("Valid") expect(ft).to include("Valid")
end end

View File

@ -68,7 +68,7 @@ describe Homebrew::Diagnostic::Checks do
ENV["PATH"] = ENV["PATH"].gsub \ ENV["PATH"] = ENV["PATH"].gsub \
%r{(?:^|#{File::PATH_SEPARATOR})#{HOMEBREW_PREFIX}/bin}o, "" %r{(?:^|#{File::PATH_SEPARATOR})#{HOMEBREW_PREFIX}/bin}o, ""
expect(checks.check_user_path_1).to be nil expect(checks.check_user_path_1).to be_nil
expect(checks.check_user_path_2) expect(checks.check_user_path_2)
.to match("Homebrew's \"bin\" was not found in your PATH.") .to match("Homebrew's \"bin\" was not found in your PATH.")
end end
@ -80,8 +80,8 @@ describe Homebrew::Diagnostic::Checks do
ENV["HOMEBREW_PATH"].gsub(/(?:^|#{Regexp.escape(File::PATH_SEPARATOR)})#{Regexp.escape(sbin)}/, "") ENV["HOMEBREW_PATH"].gsub(/(?:^|#{Regexp.escape(File::PATH_SEPARATOR)})#{Regexp.escape(sbin)}/, "")
(sbin/"something").mkpath (sbin/"something").mkpath
expect(checks.check_user_path_1).to be nil expect(checks.check_user_path_1).to be_nil
expect(checks.check_user_path_2).to be nil expect(checks.check_user_path_2).to be_nil
expect(checks.check_user_path_3) expect(checks.check_user_path_3)
.to match("Homebrew's \"sbin\" was not found in your PATH") .to match("Homebrew's \"sbin\" was not found in your PATH")
ensure ensure

View File

@ -47,12 +47,12 @@ describe "Exception" do
describe "#dependent_s" do describe "#dependent_s" do
it "returns nil if there is no dependent" do it "returns nil if there is no dependent" do
expect(error.dependent_s).to be nil expect(error.dependent_s).to be_nil
end end
it "returns nil if it depended on by itself" do it "returns nil if it depended on by itself" do
error.dependent = "foo" error.dependent = "foo"
expect(error.dependent_s).to be nil expect(error.dependent_s).to be_nil
end end
it "returns a string if there is a dependent" do it "returns a string if there is a dependent" do

View File

@ -38,9 +38,9 @@ describe Formula do
expect(f.full_name).to eq(name) expect(f.full_name).to eq(name)
expect(f.full_specified_name).to eq(name) expect(f.full_specified_name).to eq(name)
expect(f.path).to eq(path) expect(f.path).to eq(path)
expect(f.alias_path).to be nil expect(f.alias_path).to be_nil
expect(f.alias_name).to be nil expect(f.alias_name).to be_nil
expect(f.full_alias_name).to be nil expect(f.full_alias_name).to be_nil
expect(f.specified_path).to eq(path) expect(f.specified_path).to eq(path)
expect { klass.new }.to raise_error(ArgumentError) expect { klass.new }.to raise_error(ArgumentError)
end end
@ -70,9 +70,9 @@ describe Formula do
expect(f.full_name).to eq(full_name) expect(f.full_name).to eq(full_name)
expect(f.full_specified_name).to eq(full_name) expect(f.full_specified_name).to eq(full_name)
expect(f.path).to eq(path) expect(f.path).to eq(path)
expect(f.alias_path).to be nil expect(f.alias_path).to be_nil
expect(f.alias_name).to be nil expect(f.alias_name).to be_nil
expect(f.full_alias_name).to be nil expect(f.full_alias_name).to be_nil
expect(f.specified_path).to eq(path) expect(f.specified_path).to eq(path)
expect { klass.new }.to raise_error(ArgumentError) expect { klass.new }.to raise_error(ArgumentError)
end end
@ -175,9 +175,9 @@ describe Formula do
] ]
build_values_with_no_installed_alias.each do |build| build_values_with_no_installed_alias.each do |build|
f.build = build f.build = build
expect(f.installed_alias_path).to be nil expect(f.installed_alias_path).to be_nil
expect(f.installed_alias_name).to be nil expect(f.installed_alias_name).to be_nil
expect(f.full_installed_alias_name).to be nil expect(f.full_installed_alias_name).to be_nil
expect(f.installed_specified_name).to eq(f.name) expect(f.installed_specified_name).to eq(f.name)
expect(f.full_installed_specified_name).to eq(f.name) expect(f.full_installed_specified_name).to eq(f.name)
end end
@ -210,9 +210,9 @@ describe Formula do
] ]
build_values_with_no_installed_alias.each do |build| build_values_with_no_installed_alias.each do |build|
f.build = build f.build = build
expect(f.installed_alias_path).to be nil expect(f.installed_alias_path).to be_nil
expect(f.installed_alias_name).to be nil expect(f.installed_alias_name).to be_nil
expect(f.full_installed_alias_name).to be nil expect(f.full_installed_alias_name).to be_nil
expect(f.installed_specified_name).to eq(f.name) expect(f.installed_specified_name).to eq(f.name)
expect(f.full_installed_specified_name).to eq(f.full_name) expect(f.full_installed_specified_name).to eq(f.full_name)
end end
@ -401,7 +401,7 @@ describe Formula do
end end
specify "#<=>" do specify "#<=>" do
expect(Testball.new <=> Object.new).to be nil expect(Testball.new <=> Object.new).to be_nil
end end
describe "#installed_alias_path" do describe "#installed_alias_path" do
@ -414,7 +414,7 @@ describe Formula do
f.build = BuildOptions.new(Options.new, f.options) f.build = BuildOptions.new(Options.new, f.options)
expect(f.alias_path).to eq(alias_path) expect(f.alias_path).to eq(alias_path)
expect(f.installed_alias_path).to be nil expect(f.installed_alias_path).to be_nil
end end
example "alias paths with tab with non alias source path" do example "alias paths with tab with non alias source path" do
@ -427,7 +427,7 @@ describe Formula do
f.build = Tab.new(source: { "path" => source_path.to_s }) f.build = Tab.new(source: { "path" => source_path.to_s })
expect(f.alias_path).to eq(alias_path) expect(f.alias_path).to eq(alias_path)
expect(f.installed_alias_path).to be nil expect(f.installed_alias_path).to be_nil
end end
example "alias paths with tab with alias source path" do example "alias paths with tab with alias source path" do
@ -580,7 +580,7 @@ describe Formula do
url "foo-1.0" url "foo-1.0"
end end
expect(f.head).to be nil expect(f.head).to be_nil
end end
it "honors attributes declared before specs" do it "honors attributes declared before specs" do
@ -1132,7 +1132,7 @@ describe Formula do
specify "alias changes when not installed with alias" do specify "alias changes when not installed with alias" do
tab.source["path"] = Formulary.core_path(f.name).to_s tab.source["path"] = Formulary.core_path(f.name).to_s
expect(f.current_installed_alias_target).to be nil expect(f.current_installed_alias_target).to be_nil
expect(f.latest_formula).to eq(f) expect(f.latest_formula).to eq(f)
expect(f).not_to have_changed_installed_alias_target expect(f).not_to have_changed_installed_alias_target
expect(f).not_to supersede_an_installed_formula expect(f).not_to supersede_an_installed_formula
@ -1526,7 +1526,7 @@ describe Formula do
end end
it "returns nil when not installed" do it "returns nil when not installed" do
expect(f.any_installed_version).to be nil expect(f.any_installed_version).to be_nil
end end
it "returns package version when installed" do it "returns package version when installed" do

View File

@ -40,7 +40,7 @@ describe Formula do
head "foo" head "foo"
end end
expect(f.stable).to be nil expect(f.stable).to be_nil
expect(f).to be_head expect(f).to be_head
end end

View File

@ -81,7 +81,7 @@ describe InstalledDependents do
specify "no dependencies anywhere" do specify "no dependencies anywhere" do
dependencies nil dependencies nil
expect(described_class.find_some_installed_dependents([keg])).to be nil expect(described_class.find_some_installed_dependents([keg])).to be_nil
end end
specify "missing Formula dependency" do specify "missing Formula dependency" do
@ -93,7 +93,7 @@ describe InstalledDependents do
specify "uninstalling dependent and dependency" do specify "uninstalling dependent and dependency" do
dependencies nil dependencies nil
Formula["bar"].class.depends_on "foo" Formula["bar"].class.depends_on "foo"
expect(described_class.find_some_installed_dependents([keg, dependent])).to be nil expect(described_class.find_some_installed_dependents([keg, dependent])).to be_nil
end end
specify "renamed dependency" do specify "renamed dependency" do
@ -112,7 +112,7 @@ describe InstalledDependents do
specify "empty dependencies in Tab" do specify "empty dependencies in Tab" do
dependencies [] dependencies []
expect(described_class.find_some_installed_dependents([keg])).to be nil expect(described_class.find_some_installed_dependents([keg])).to be_nil
end end
specify "same name but different version in Tab" do specify "same name but different version in Tab" do
@ -123,7 +123,7 @@ describe InstalledDependents do
specify "different name and same version in Tab" do specify "different name and same version in Tab" do
stub_formula_name("baz") stub_formula_name("baz")
dependencies [{ "full_name" => "baz", "version" => keg.version.to_s }] dependencies [{ "full_name" => "baz", "version" => keg.version.to_s }]
expect(described_class.find_some_installed_dependents([keg])).to be nil expect(described_class.find_some_installed_dependents([keg])).to be_nil
end end
specify "same name and version in Tab" do specify "same name and version in Tab" do
@ -140,7 +140,7 @@ describe InstalledDependents do
specify "non-opt-linked" do specify "non-opt-linked" do
keg.remove_opt_record keg.remove_opt_record
dependencies [{ "full_name" => "foo", "version" => "1.0" }] dependencies [{ "full_name" => "foo", "version" => "1.0" }]
expect(described_class.find_some_installed_dependents([keg])).to be nil expect(described_class.find_some_installed_dependents([keg])).to be_nil
end end
specify "keg-only" do specify "keg-only" do

View File

@ -55,7 +55,7 @@ describe Keg do
end end
specify "#oldname_opt_record" do specify "#oldname_opt_record" do
expect(keg.oldname_opt_record).to be nil expect(keg.oldname_opt_record).to be_nil
oldname_opt_record = HOMEBREW_PREFIX/"opt/oldfoo" oldname_opt_record = HOMEBREW_PREFIX/"opt/oldfoo"
oldname_opt_record.make_relative_symlink(HOMEBREW_CELLAR/"foo/1.0") oldname_opt_record.make_relative_symlink(HOMEBREW_CELLAR/"foo/1.0")
expect(keg.oldname_opt_record).to eq(oldname_opt_record) expect(keg.oldname_opt_record).to eq(oldname_opt_record)

View File

@ -68,7 +68,7 @@ describe Homebrew::Livecheck::Strategy::Sparkle do
let(:item_from_appcast_xml) { sparkle.item_from_content(appcast_xml) } let(:item_from_appcast_xml) { sparkle.item_from_content(appcast_xml) }
it "returns nil if content is blank" do it "returns nil if content is blank" do
expect(sparkle.item_from_content("")).to be nil expect(sparkle.item_from_content("")).to be_nil
end end
it "returns an Item when given XML data" do it "returns an Item when given XML data" do

View File

@ -30,7 +30,7 @@ describe Livecheck do
describe "#formula" do describe "#formula" do
it "returns nil if not set" do it "returns nil if not set" do
expect(livecheckable_f.formula).to be nil expect(livecheckable_f.formula).to be_nil
end end
it "returns the String if set" do it "returns the String if set" do
@ -47,7 +47,7 @@ describe Livecheck do
describe "#cask" do describe "#cask" do
it "returns nil if not set" do it "returns nil if not set" do
expect(livecheckable_c.cask).to be nil expect(livecheckable_c.cask).to be_nil
end end
it "returns the String if set" do it "returns the String if set" do
@ -64,7 +64,7 @@ describe Livecheck do
describe "#regex" do describe "#regex" do
it "returns nil if not set" do it "returns nil if not set" do
expect(livecheckable_f.regex).to be nil expect(livecheckable_f.regex).to be_nil
end end
it "returns the Regexp if set" do it "returns the Regexp if set" do
@ -83,7 +83,7 @@ describe Livecheck do
it "sets @skip to true when no argument is provided" do it "sets @skip to true when no argument is provided" do
expect(livecheckable_f.skip).to be true expect(livecheckable_f.skip).to be true
expect(livecheckable_f.instance_variable_get(:@skip)).to be true expect(livecheckable_f.instance_variable_get(:@skip)).to be true
expect(livecheckable_f.instance_variable_get(:@skip_msg)).to be nil expect(livecheckable_f.instance_variable_get(:@skip_msg)).to be_nil
end end
it "sets @skip to true and @skip_msg to the provided String" do it "sets @skip to true and @skip_msg to the provided String" do
@ -110,7 +110,7 @@ describe Livecheck do
describe "#strategy" do describe "#strategy" do
it "returns nil if not set" do it "returns nil if not set" do
expect(livecheckable_f.strategy).to be nil expect(livecheckable_f.strategy).to be_nil
end end
it "returns the Symbol if set" do it "returns the Symbol if set" do
@ -129,7 +129,7 @@ describe Livecheck do
let(:url_string) { "https://brew.sh" } let(:url_string) { "https://brew.sh" }
it "returns nil if not set" do it "returns nil if not set" do
expect(livecheckable_f.url).to be nil expect(livecheckable_f.url).to be_nil
end end
it "returns a string when set to a string" do it "returns a string when set to a string" do

View File

@ -35,19 +35,19 @@ describe DependencyCollector do
it "does not create a resource dependency from a '.xz' URL" do it "does not create a resource dependency from a '.xz' URL" do
resource.url("https://brew.sh/foo.xz") resource.url("https://brew.sh/foo.xz")
allow_any_instance_of(Object).to receive(:which).with("xz").and_return(Pathname.new("foo")) allow_any_instance_of(Object).to receive(:which).with("xz").and_return(Pathname.new("foo"))
expect(collector.add(resource)).to be nil expect(collector.add(resource)).to be_nil
end end
it "does not create a resource dependency from a '.zip' URL" do it "does not create a resource dependency from a '.zip' URL" do
resource.url("https://brew.sh/foo.zip") resource.url("https://brew.sh/foo.zip")
allow_any_instance_of(Object).to receive(:which).with("unzip").and_return(Pathname.new("foo")) allow_any_instance_of(Object).to receive(:which).with("unzip").and_return(Pathname.new("foo"))
expect(collector.add(resource)).to be nil expect(collector.add(resource)).to be_nil
end end
it "does not create a resource dependency from a '.bz2' URL" do it "does not create a resource dependency from a '.bz2' URL" do
resource.url("https://brew.sh/foo.tar.bz2") resource.url("https://brew.sh/foo.tar.bz2")
allow_any_instance_of(Object).to receive(:which).with("bzip2").and_return(Pathname.new("foo")) allow_any_instance_of(Object).to receive(:which).with("bzip2").and_return(Pathname.new("foo"))
expect(collector.add(resource)).to be nil expect(collector.add(resource)).to be_nil
end end
end end
end end

View File

@ -11,34 +11,34 @@ describe DependencyCollector do
specify "Resource dependency from a '.xz' URL" do specify "Resource dependency from a '.xz' URL" do
resource = Resource.new resource = Resource.new
resource.url("https://brew.sh/foo.tar.xz") resource.url("https://brew.sh/foo.tar.xz")
expect(collector.add(resource)).to be nil expect(collector.add(resource)).to be_nil
end end
specify "Resource dependency from a '.zip' URL" do specify "Resource dependency from a '.zip' URL" do
resource = Resource.new resource = Resource.new
resource.url("https://brew.sh/foo.zip") resource.url("https://brew.sh/foo.zip")
expect(collector.add(resource)).to be nil expect(collector.add(resource)).to be_nil
end end
specify "Resource dependency from a '.bz2' URL" do specify "Resource dependency from a '.bz2' URL" do
resource = Resource.new resource = Resource.new
resource.url("https://brew.sh/foo.tar.bz2") resource.url("https://brew.sh/foo.tar.bz2")
expect(collector.add(resource)).to be nil expect(collector.add(resource)).to be_nil
end end
specify "Resource dependency from a '.git' URL" do specify "Resource dependency from a '.git' URL" do
resource = Resource.new resource = Resource.new
resource.url("git://brew.sh/foo/bar.git") resource.url("git://brew.sh/foo/bar.git")
expect(collector.add(resource)).to be nil expect(collector.add(resource)).to be_nil
end end
specify "Resource dependency from a Subversion URL" do specify "Resource dependency from a Subversion URL" do
resource = Resource.new resource = Resource.new
resource.url("svn://brew.sh/foo/bar") resource.url("svn://brew.sh/foo/bar")
if MacOS.version < :catalina if MacOS.version < :catalina
expect(collector.add(resource)).to be nil expect(collector.add(resource)).to be_nil
else else
expect(collector.add(resource)).not_to be nil expect(collector.add(resource)).not_to be_nil
end end
end end
end end

View File

@ -56,12 +56,12 @@ describe PkgVersion do
describe "#<=>" do describe "#<=>" do
it "returns nil if the comparison fails" do it "returns nil if the comparison fails" do
expect(described_class.new(Version.create("1.0"), 0) <=> Object.new).to be nil expect(described_class.new(Version.create("1.0"), 0) <=> Object.new).to be_nil
expect(Object.new <=> described_class.new(Version.create("1.0"), 0)).to be nil expect(Object.new <=> described_class.new(Version.create("1.0"), 0)).to be_nil
expect(Object.new <=> described_class.new(Version.create("1.0"), 0)).to be nil expect(Object.new <=> described_class.new(Version.create("1.0"), 0)).to be_nil
expect(described_class.new(Version.create("1.0"), 0) <=> nil).to be nil expect(described_class.new(Version.create("1.0"), 0) <=> nil).to be_nil
# This one used to fail due to dereferencing a null `self` # This one used to fail due to dereferencing a null `self`
expect(described_class.new(nil, 0) <=> described_class.new(Version.create("1.0"), 0)).to be nil expect(described_class.new(nil, 0) <=> described_class.new(Version.create("1.0"), 0)).to be_nil
end end
end end

View File

@ -180,7 +180,7 @@ describe Requirement do
let(:klass) { Class.new(described_class) } let(:klass) { Class.new(described_class) }
it "returns nil" do it "returns nil" do
expect(requirement.modify_build_environment).to be nil expect(requirement.modify_build_environment).to be_nil
end end
end end
end end

View File

@ -85,7 +85,7 @@ describe Resource do
end end
it "returns nil if unset" do it "returns nil if unset" do
expect(resource.version).to be nil expect(resource.version).to be_nil
end end
end end
@ -103,7 +103,7 @@ describe Resource do
describe "#checksum" do describe "#checksum" do
it "returns nil if unset" do it "returns nil if unset" do
expect(resource.checksum).to be nil expect(resource.checksum).to be_nil
end end
it "returns the checksum set with #sha256" do it "returns the checksum set with #sha256" do

View File

@ -11,6 +11,6 @@ describe HeadSoftwareSpec do
end end
specify "#verify_download_integrity" do specify "#verify_download_integrity" do
expect(head_spec.verify_download_integrity(Object.new)).to be nil expect(head_spec.verify_download_integrity(Object.new)).to be_nil
end end
end end

View File

@ -170,7 +170,7 @@ describe SystemCommand::Result do
let(:stdout) { "" } let(:stdout) { "" }
it "returns nil" do it "returns nil" do
expect(result_plist).to be nil expect(result_plist).to be_nil
end end
end end
end end

View File

@ -64,20 +64,20 @@ describe Tab do
expect(tab.homebrew_version).to eq(HOMEBREW_VERSION) expect(tab.homebrew_version).to eq(HOMEBREW_VERSION)
expect(tab.unused_options).to be_empty expect(tab.unused_options).to be_empty
expect(tab.used_options).to be_empty expect(tab.used_options).to be_empty
expect(tab.changed_files).to be nil expect(tab.changed_files).to be_nil
expect(tab).not_to be_built_as_bottle expect(tab).not_to be_built_as_bottle
expect(tab).not_to be_poured_from_bottle expect(tab).not_to be_poured_from_bottle
expect(tab).to be_stable expect(tab).to be_stable
expect(tab).not_to be_head expect(tab).not_to be_head
expect(tab.tap).to be nil expect(tab.tap).to be_nil
expect(tab.time).to be nil expect(tab.time).to be_nil
expect(tab.HEAD).to be nil expect(tab.HEAD).to be_nil
expect(tab.runtime_dependencies).to be nil expect(tab.runtime_dependencies).to be_nil
expect(tab.stable_version).to be nil expect(tab.stable_version).to be_nil
expect(tab.head_version).to be nil expect(tab.head_version).to be_nil
expect(tab.cxxstdlib.compiler).to eq(DevelopmentTools.default_compiler) expect(tab.cxxstdlib.compiler).to eq(DevelopmentTools.default_compiler)
expect(tab.cxxstdlib.type).to be nil expect(tab.cxxstdlib.type).to be_nil
expect(tab.source["path"]).to be nil expect(tab.source["path"]).to be_nil
end end
specify "#include?" do specify "#include?" do
@ -114,25 +114,25 @@ describe Tab do
specify "#runtime_dependencies" do specify "#runtime_dependencies" do
tab = described_class.new tab = described_class.new
expect(tab.runtime_dependencies).to be nil expect(tab.runtime_dependencies).to be_nil
tab.homebrew_version = "1.1.6" tab.homebrew_version = "1.1.6"
expect(tab.runtime_dependencies).to be nil expect(tab.runtime_dependencies).to be_nil
tab.runtime_dependencies = [] tab.runtime_dependencies = []
expect(tab.runtime_dependencies).not_to be nil expect(tab.runtime_dependencies).not_to be_nil
tab.homebrew_version = "1.1.5" tab.homebrew_version = "1.1.5"
expect(tab.runtime_dependencies).to be nil expect(tab.runtime_dependencies).to be_nil
tab.homebrew_version = "1.1.7" tab.homebrew_version = "1.1.7"
expect(tab.runtime_dependencies).not_to be nil expect(tab.runtime_dependencies).not_to be_nil
tab.homebrew_version = "1.1.10" tab.homebrew_version = "1.1.10"
expect(tab.runtime_dependencies).not_to be nil expect(tab.runtime_dependencies).not_to be_nil
tab.runtime_dependencies = [{ "full_name" => "foo", "version" => "1.0" }] tab.runtime_dependencies = [{ "full_name" => "foo", "version" => "1.0" }]
expect(tab.runtime_dependencies).not_to be nil expect(tab.runtime_dependencies).not_to be_nil
end end
specify "::runtime_deps_hash" do specify "::runtime_deps_hash" do
@ -232,7 +232,7 @@ describe Tab do
expect(tab.HEAD).to eq(TEST_SHA1) expect(tab.HEAD).to eq(TEST_SHA1)
expect(tab.cxxstdlib.compiler).to eq(:clang) expect(tab.cxxstdlib.compiler).to eq(:clang)
expect(tab.cxxstdlib.type).to eq(:libcxx) expect(tab.cxxstdlib.type).to eq(:libcxx)
expect(tab.runtime_dependencies).to be nil expect(tab.runtime_dependencies).to be_nil
end end
it "raises a parse exception message including the Tab filename" do it "raises a parse exception message including the Tab filename" do
@ -331,7 +331,7 @@ describe Tab do
f.prefix.mkpath f.prefix.mkpath
tab = described_class.for_formula(f) tab = described_class.for_formula(f)
expect(tab.tabfile).to be nil expect(tab.tabfile).to be_nil
end end
it "can create a Tab for a Formula with multiple Kegs" do it "can create a Tab for a Formula with multiple Kegs" do

View File

@ -156,7 +156,7 @@ describe Tap do
expect(homebrew_foo_tap.issues_url).to eq("https://github.com/Homebrew/homebrew-foo/issues") expect(homebrew_foo_tap.issues_url).to eq("https://github.com/Homebrew/homebrew-foo/issues")
(Tap::TAP_DIRECTORY/"someone/homebrew-no-git").mkpath (Tap::TAP_DIRECTORY/"someone/homebrew-no-git").mkpath
expect(described_class.new("someone", "no-git").issues_url).to be nil expect(described_class.new("someone", "no-git").issues_url).to be_nil
ensure ensure
path.parent.rmtree path.parent.rmtree
end end
@ -198,13 +198,13 @@ describe Tap do
end end
it "returns nil if the Tap is not a Git repository" do it "returns nil if the Tap is not a Git repository" do
expect(homebrew_foo_tap.remote).to be nil expect(homebrew_foo_tap.remote).to be_nil
end end
it "returns nil if Git is not available" do it "returns nil if Git is not available" do
setup_git_repo setup_git_repo
allow(Utils::Git).to receive(:available?).and_return(false) allow(Utils::Git).to receive(:available?).and_return(false)
expect(homebrew_foo_tap.remote).to be nil expect(homebrew_foo_tap.remote).to be_nil
end end
end end
@ -240,13 +240,13 @@ describe Tap do
end end
it "returns nil if the Tap is not a Git repository" do it "returns nil if the Tap is not a Git repository" do
expect(homebrew_foo_tap.remote_repo).to be nil expect(homebrew_foo_tap.remote_repo).to be_nil
end end
it "returns nil if Git is not available" do it "returns nil if Git is not available" do
setup_git_repo setup_git_repo
allow(Utils::Git).to receive(:available?).and_return(false) allow(Utils::Git).to receive(:available?).and_return(false)
expect(homebrew_foo_tap.remote_repo).to be nil expect(homebrew_foo_tap.remote_repo).to be_nil
end end
end end
@ -450,11 +450,11 @@ describe Tap do
specify "#config" do specify "#config" do
setup_git_repo setup_git_repo
expect(homebrew_foo_tap.config["foo"]).to be nil expect(homebrew_foo_tap.config["foo"]).to be_nil
homebrew_foo_tap.config["foo"] = "bar" homebrew_foo_tap.config["foo"] = "bar"
expect(homebrew_foo_tap.config["foo"]).to eq("bar") expect(homebrew_foo_tap.config["foo"]).to eq("bar")
homebrew_foo_tap.config["foo"] = nil homebrew_foo_tap.config["foo"] = nil
expect(homebrew_foo_tap.config["foo"]).to be nil expect(homebrew_foo_tap.config["foo"]).to be_nil
end end
describe "#each" do describe "#each" do

View File

@ -21,12 +21,12 @@ describe Utils::Bottles::Collector do
end end
it "returns nil if empty" do it "returns nil if empty" do
expect(collector.specification_for(Utils::Bottles::Tag.from_symbol(:foo))).to be nil expect(collector.specification_for(Utils::Bottles::Tag.from_symbol(:foo))).to be_nil
end end
it "returns nil when there is no match" do it "returns nil when there is no match" do
collector.add(catalina, checksum: Checksum.new("bar_checksum"), cellar: "bar_cellar") collector.add(catalina, checksum: Checksum.new("bar_checksum"), cellar: "bar_cellar")
expect(collector.specification_for(Utils::Bottles::Tag.from_symbol(:foo))).to be nil expect(collector.specification_for(Utils::Bottles::Tag.from_symbol(:foo))).to be_nil
end end
it "uses older tags when needed", :needs_macos do it "uses older tags when needed", :needs_macos do

View File

@ -56,9 +56,9 @@ describe Utils::Shell do
end end
it "returns nil when input is invalid" do it "returns nil when input is invalid" do
expect(described_class.from_path("")).to be nil expect(described_class.from_path("")).to be_nil
expect(described_class.from_path("@@@@@@")).to be nil expect(described_class.from_path("@@@@@@")).to be_nil
expect(described_class.from_path("invalid_shell-4.2")).to be nil expect(described_class.from_path("invalid_shell-4.2")).to be_nil
end end
end end

View File

@ -132,7 +132,7 @@ describe "globally-scoped helper methods" do
end end
it "skips non-executables" do it "skips non-executables" do
expect(which(File.basename(cmd), File.dirname(cmd))).to be nil expect(which(File.basename(cmd), File.dirname(cmd))).to be_nil
end end
it "skips malformed path and doesn't fail" do it "skips malformed path and doesn't fail" do

View File

@ -35,13 +35,13 @@ describe Version do
specify "comparison returns nil for non-token" do specify "comparison returns nil for non-token" do
v = described_class.create("1") v = described_class.create("1")
expect(v <=> Object.new).to be nil expect(v <=> Object.new).to be_nil
expect { v > Object.new }.to raise_error(ArgumentError) expect { v > Object.new }.to raise_error(ArgumentError)
end end
describe "#to_str" do describe "#to_str" do
it "implicitly converts token to string" do it "implicitly converts token to string" do
expect(String.try_convert(described_class.new("foo"))).not_to be nil expect(String.try_convert(described_class.new("foo"))).not_to be_nil
end end
end end
end end
@ -211,7 +211,7 @@ describe Version do
specify "comparison returns nil for non-version" do specify "comparison returns nil for non-version" do
v = described_class.create("1.0") v = described_class.create("1.0")
expect(v <=> Object.new).to be nil expect(v <=> Object.new).to be_nil
expect { v > Object.new }.to raise_error(ArgumentError) expect { v > Object.new }.to raise_error(ArgumentError)
end end
@ -271,7 +271,7 @@ describe Version do
specify "HEAD without commit" do specify "HEAD without commit" do
v = described_class.create("HEAD") v = described_class.create("HEAD")
expect(v.commit).to be nil expect(v.commit).to be_nil
expect(v.to_str).to eq("HEAD") expect(v.to_str).to eq("HEAD")
end end
end end
@ -326,7 +326,7 @@ describe Version do
describe "#minor" do describe "#minor" do
it "returns minor version token" do it "returns minor version token" do
expect(described_class.create("1").minor).to be nil expect(described_class.create("1").minor).to be_nil
expect(described_class.create("1.2").minor).to be == Version::Token.create("2") expect(described_class.create("1.2").minor).to be == Version::Token.create("2")
expect(described_class.create("1.2.3").minor).to be == Version::Token.create("2") expect(described_class.create("1.2.3").minor).to be == Version::Token.create("2")
expect(described_class.create("1.2.3alpha").minor).to be == Version::Token.create("2") expect(described_class.create("1.2.3alpha").minor).to be == Version::Token.create("2")
@ -340,8 +340,8 @@ describe Version do
describe "#patch" do describe "#patch" do
it "returns patch version token" do it "returns patch version token" do
expect(described_class.create("1").patch).to be nil expect(described_class.create("1").patch).to be_nil
expect(described_class.create("1.2").patch).to be nil expect(described_class.create("1.2").patch).to be_nil
expect(described_class.create("1.2.3").patch).to be == Version::Token.create("3") expect(described_class.create("1.2.3").patch).to be == Version::Token.create("3")
expect(described_class.create("1.2.3alpha").patch).to be == Version::Token.create("3") expect(described_class.create("1.2.3alpha").patch).to be == Version::Token.create("3")
expect(described_class.create("1.2.3alpha4").patch).to be == Version::Token.create("3") expect(described_class.create("1.2.3alpha4").patch).to be == Version::Token.create("3")