From cb2a09e65edea06059a3b75371ffd5492b9bdb85 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Tue, 1 Mar 2022 00:36:05 +0000 Subject: [PATCH] Fix (auto-correct) more `RSpec/BeNil` offenses - The `RSpec/BeEq` auto-corrections made more `RSpec/BeNil` offenses, so another go of `brew style --only=RSpec/BeNil --fix\` is needed. --- Library/Homebrew/test/checksum_spec.rb | 2 +- Library/Homebrew/test/formula_spec.rb | 6 +++--- Library/Homebrew/test/livecheck/livecheck_spec.rb | 8 ++++---- Library/Homebrew/test/livecheck/skip_conditions_spec.rb | 4 ++-- Library/Homebrew/test/os/linux/formula_spec.rb | 2 +- Library/Homebrew/test/os/mac/formula_spec.rb | 2 +- Library/Homebrew/test/utils/git_repository_spec.rb | 4 ++-- Library/Homebrew/test/utils/git_spec.rb | 4 ++-- Library/Homebrew/test/utils/pypi_spec.rb | 4 ++-- Library/Homebrew/test/utils/spdx_spec.rb | 8 ++++---- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Library/Homebrew/test/checksum_spec.rb b/Library/Homebrew/test/checksum_spec.rb index 479adfea98..9216126dd0 100644 --- a/Library/Homebrew/test/checksum_spec.rb +++ b/Library/Homebrew/test/checksum_spec.rb @@ -18,6 +18,6 @@ describe Checksum do it { is_expected.to eq(other) } it { is_expected.not_to eq(other_reversed) } - it { is_expected.not_to be(nil) } + it { is_expected.not_to be_nil } end end diff --git a/Library/Homebrew/test/formula_spec.rb b/Library/Homebrew/test/formula_spec.rb index 72505c9404..8c5ee1b2f5 100644 --- a/Library/Homebrew/test/formula_spec.rb +++ b/Library/Homebrew/test/formula_spec.rb @@ -719,7 +719,7 @@ describe Formula do url "https://brew.sh/test-1.0.tbz" end - expect(f.service).to be(nil) + expect(f.service).to be_nil end specify "service complicated" do @@ -735,7 +735,7 @@ describe Formula do working_dir var keep_alive true end - expect(f.service).not_to be(nil) + expect(f.service).not_to be_nil end specify "service uses simple run" do @@ -746,7 +746,7 @@ describe Formula do end end - expect(f.service).not_to be(nil) + expect(f.service).not_to be_nil end specify "service helpers return data" do diff --git a/Library/Homebrew/test/livecheck/livecheck_spec.rb b/Library/Homebrew/test/livecheck/livecheck_spec.rb index d20858650d..f2fbb3f97f 100644 --- a/Library/Homebrew/test/livecheck/livecheck_spec.rb +++ b/Library/Homebrew/test/livecheck/livecheck_spec.rb @@ -142,10 +142,10 @@ describe Homebrew::Livecheck do end it "returns nil when not given a string or valid symbol" do - expect(livecheck.livecheck_url_to_string(nil, f_livecheck_url)).to be(nil) - expect(livecheck.livecheck_url_to_string(nil, c_livecheck_url)).to be(nil) - expect(livecheck.livecheck_url_to_string(:invalid_symbol, f_livecheck_url)).to be(nil) - expect(livecheck.livecheck_url_to_string(:invalid_symbol, c_livecheck_url)).to be(nil) + expect(livecheck.livecheck_url_to_string(nil, f_livecheck_url)).to be_nil + expect(livecheck.livecheck_url_to_string(nil, c_livecheck_url)).to be_nil + expect(livecheck.livecheck_url_to_string(:invalid_symbol, f_livecheck_url)).to be_nil + expect(livecheck.livecheck_url_to_string(:invalid_symbol, c_livecheck_url)).to be_nil end end diff --git a/Library/Homebrew/test/livecheck/skip_conditions_spec.rb b/Library/Homebrew/test/livecheck/skip_conditions_spec.rb index 399b1264cc..1ede45b53a 100644 --- a/Library/Homebrew/test/livecheck/skip_conditions_spec.rb +++ b/Library/Homebrew/test/livecheck/skip_conditions_spec.rb @@ -458,11 +458,11 @@ describe Homebrew::Livecheck::SkipConditions do end it "returns an empty hash for a non-skippable formula" do - expect(skip_conditions.referenced_skip_information(formulae[:basic], original_name)).to be(nil) + expect(skip_conditions.referenced_skip_information(formulae[:basic], original_name)).to be_nil end it "returns an empty hash for a non-skippable cask" do - expect(skip_conditions.referenced_skip_information(casks[:basic], original_name)).to be(nil) + expect(skip_conditions.referenced_skip_information(casks[:basic], original_name)).to be_nil end end diff --git a/Library/Homebrew/test/os/linux/formula_spec.rb b/Library/Homebrew/test/os/linux/formula_spec.rb index 836b4cd5f6..7b585ab2f7 100644 --- a/Library/Homebrew/test/os/linux/formula_spec.rb +++ b/Library/Homebrew/test/os/linux/formula_spec.rb @@ -54,7 +54,7 @@ describe Formula do expect(f.class.stable.deps[0].name).to eq("hello_both") expect(f.class.stable.deps[1].name).to eq("hello_linux") - expect(f.class.stable.deps[2]).to be(nil) + expect(f.class.stable.deps[2]).to be_nil end it "adds a patch on Linux only" do diff --git a/Library/Homebrew/test/os/mac/formula_spec.rb b/Library/Homebrew/test/os/mac/formula_spec.rb index ca3a97aecd..9cb4685493 100644 --- a/Library/Homebrew/test/os/mac/formula_spec.rb +++ b/Library/Homebrew/test/os/mac/formula_spec.rb @@ -59,7 +59,7 @@ describe Formula do expect(f.class.stable.deps[0].name).to eq("hello_both") expect(f.class.stable.deps[1].name).to eq("hello_macos") - expect(f.class.stable.deps[2]).to be(nil) + expect(f.class.stable.deps[2]).to be_nil end it "adds a patch on Mac only" do diff --git a/Library/Homebrew/test/utils/git_repository_spec.rb b/Library/Homebrew/test/utils/git_repository_spec.rb index c55abfc950..2f609295e9 100644 --- a/Library/Homebrew/test/utils/git_repository_spec.rb +++ b/Library/Homebrew/test/utils/git_repository_spec.rb @@ -7,7 +7,7 @@ describe Utils do shared_examples "git_repository helper function" do |method_name| context "when directory is not a Git repository" do it "returns nil if `safe` parameter is `false`" do - expect(described_class.public_send(method_name, TEST_TMPDIR, safe: false)).to be(nil) + expect(described_class.public_send(method_name, TEST_TMPDIR, safe: false)).to be_nil end it "raises an error if `safe` parameter is `true`" do @@ -22,7 +22,7 @@ describe Utils do end it "returns nil if `safe` parameter is `false`" do - expect(described_class.public_send(method_name, HOMEBREW_CACHE, safe: false)).to be(nil) + expect(described_class.public_send(method_name, HOMEBREW_CACHE, safe: false)).to be_nil end it "raises an error if `safe` parameter is `true`" do diff --git a/Library/Homebrew/test/utils/git_spec.rb b/Library/Homebrew/test/utils/git_spec.rb index 4cc330460f..58ec7c975f 100644 --- a/Library/Homebrew/test/utils/git_spec.rb +++ b/Library/Homebrew/test/utils/git_spec.rb @@ -142,7 +142,7 @@ describe Utils::Git do describe "::path" do it "returns nil when git is not available" do stub_const("HOMEBREW_SHIMS_PATH", HOMEBREW_PREFIX/"bin/shim") - expect(described_class.path).to be(nil) + expect(described_class.path).to be_nil end it "returns path of git when git is available" do @@ -153,7 +153,7 @@ describe Utils::Git do describe "::version" do it "returns nil when git is not available" do stub_const("HOMEBREW_SHIMS_PATH", HOMEBREW_PREFIX/"bin/shim") - expect(described_class.version).to be(nil) + expect(described_class.version).to be_nil end it "returns version of git when git is available" do diff --git a/Library/Homebrew/test/utils/pypi_spec.rb b/Library/Homebrew/test/utils/pypi_spec.rb index ee6b07cd40..a6787c11b1 100644 --- a/Library/Homebrew/test/utils/pypi_spec.rb +++ b/Library/Homebrew/test/utils/pypi_spec.rb @@ -174,11 +174,11 @@ describe PyPI do end it "returns nil for invalid versions" do - expect(described_class.update_pypi_url(old_package_url, "0.0.0")).to be nil + expect(described_class.update_pypi_url(old_package_url, "0.0.0")).to be_nil end it "returns nil for non-pypi urls" do - expect(described_class.update_pypi_url("https://brew.sh/foo-1.0.tgz", "1.1")).to be nil + expect(described_class.update_pypi_url("https://brew.sh/foo-1.0.tgz", "1.1")).to be_nil end end end diff --git a/Library/Homebrew/test/utils/spdx_spec.rb b/Library/Homebrew/test/utils/spdx_spec.rb index e54f57447b..192098b32d 100644 --- a/Library/Homebrew/test/utils/spdx_spec.rb +++ b/Library/Homebrew/test/utils/spdx_spec.rb @@ -6,11 +6,11 @@ require "utils/spdx" describe SPDX do describe ".license_data" do it "has the license list version" do - expect(described_class.license_data["licenseListVersion"]).not_to be(nil) + expect(described_class.license_data["licenseListVersion"]).not_to be_nil end it "has the release date" do - expect(described_class.license_data["releaseDate"]).not_to be(nil) + expect(described_class.license_data["releaseDate"]).not_to be_nil end it "has licenses" do @@ -20,11 +20,11 @@ describe SPDX do describe ".exception_data" do it "has the license list version" do - expect(described_class.exception_data["licenseListVersion"]).not_to be(nil) + expect(described_class.exception_data["licenseListVersion"]).not_to be_nil end it "has the release date" do - expect(described_class.exception_data["releaseDate"]).not_to be(nil) + expect(described_class.exception_data["releaseDate"]).not_to be_nil end it "has exceptions" do