Fix (auto-correct) RuboCop Rspec/BeEq offenses
This commit is contained in:
parent
6b76fd012a
commit
72e48024f0
@ -53,12 +53,12 @@ describe Homebrew::API::Bottle do
|
||||
describe "::available?" do
|
||||
it "returns `true` if `fetch` succeeds" do
|
||||
allow(described_class).to receive(:fetch)
|
||||
expect(described_class.available?("foo")).to eq true
|
||||
expect(described_class.available?("foo")).to be true
|
||||
end
|
||||
|
||||
it "returns `false` if `fetch` fails" do
|
||||
allow(described_class).to receive(:fetch).and_raise ArgumentError
|
||||
expect(described_class.available?("foo")).to eq false
|
||||
expect(described_class.available?("foo")).to be false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -107,7 +107,7 @@ describe Caveats do
|
||||
end
|
||||
caveats = described_class.new(f).caveats
|
||||
|
||||
expect(f.service?).to eq(true)
|
||||
expect(f.service?).to be(true)
|
||||
expect(caveats).to include("#{f.bin}/php test")
|
||||
expect(caveats).to include("background service")
|
||||
end
|
||||
|
||||
@ -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 eq(nil) }
|
||||
it { is_expected.not_to be(nil) }
|
||||
end
|
||||
end
|
||||
|
||||
@ -207,9 +207,9 @@ describe Homebrew::Completions do
|
||||
|
||||
it "handles --[no]- options correctly" do
|
||||
options = described_class.command_options("audit")
|
||||
expect(options.key?("--appcast")).to eq true
|
||||
expect(options.key?("--no-appcast")).to eq true
|
||||
expect(options["--appcast"] == options["--no-appcast"]).to eq true
|
||||
expect(options.key?("--appcast")).to be true
|
||||
expect(options.key?("--no-appcast")).to be true
|
||||
expect(options["--appcast"] == options["--no-appcast"]).to be true
|
||||
end
|
||||
|
||||
it "return an empty array if command is not found" do
|
||||
@ -228,15 +228,15 @@ describe Homebrew::Completions do
|
||||
|
||||
describe ".command_gets_completions?" do
|
||||
it "returns true for a non-cask command with options" do
|
||||
expect(described_class.command_gets_completions?("install")).to eq true
|
||||
expect(described_class.command_gets_completions?("install")).to be true
|
||||
end
|
||||
|
||||
it "returns false for a non-cask command with no options" do
|
||||
expect(described_class.command_gets_completions?("help")).to eq false
|
||||
expect(described_class.command_gets_completions?("help")).to be false
|
||||
end
|
||||
|
||||
it "returns false for a cask command" do
|
||||
expect(described_class.command_gets_completions?("cask install")).to eq false
|
||||
expect(described_class.command_gets_completions?("cask install")).to be false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -719,7 +719,7 @@ describe Formula do
|
||||
url "https://brew.sh/test-1.0.tbz"
|
||||
end
|
||||
|
||||
expect(f.service).to eq(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 eq(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 eq(nil)
|
||||
expect(f.service).not_to be(nil)
|
||||
end
|
||||
|
||||
specify "service helpers return data" do
|
||||
|
||||
@ -173,7 +173,7 @@ describe InstalledDependents do
|
||||
specify "identify dependent casks" do
|
||||
setup_test_cask("qux", "1.0.0", "foo")
|
||||
dependents = described_class.find_some_installed_dependents([keg]).last
|
||||
expect(dependents.include?("qux")).to eq(true)
|
||||
expect(dependents.include?("qux")).to be(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -16,7 +16,7 @@ describe Language::Node do
|
||||
described_class.instance_variable_set(:@env_set, false)
|
||||
expect(described_class.setup_npm_environment).to be_nil
|
||||
|
||||
expect(described_class.instance_variable_get(:@env_set)).to eq(true)
|
||||
expect(described_class.instance_variable_get(:@env_set)).to be(true)
|
||||
expect(ENV).not_to receive(:prepend_path)
|
||||
expect(described_class.setup_npm_environment).to be_nil
|
||||
end
|
||||
|
||||
@ -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 eq(nil)
|
||||
expect(livecheck.livecheck_url_to_string(nil, c_livecheck_url)).to eq(nil)
|
||||
expect(livecheck.livecheck_url_to_string(:invalid_symbol, f_livecheck_url)).to eq(nil)
|
||||
expect(livecheck.livecheck_url_to_string(:invalid_symbol, c_livecheck_url)).to eq(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
|
||||
|
||||
|
||||
@ -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 eq(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 eq(nil)
|
||||
expect(skip_conditions.referenced_skip_information(casks[:basic], original_name)).to be(nil)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -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 eq(nil)
|
||||
expect(f.class.stable.deps[2]).to be(nil)
|
||||
end
|
||||
|
||||
it "adds a patch on Linux only" do
|
||||
|
||||
@ -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 eq(nil)
|
||||
expect(f.class.stable.deps[2]).to be(nil)
|
||||
end
|
||||
|
||||
it "adds a patch on Mac only" do
|
||||
|
||||
@ -412,7 +412,7 @@ describe Homebrew::Service do
|
||||
run_type :immediate
|
||||
end
|
||||
|
||||
expect(f.service.timed?).to eq(false)
|
||||
expect(f.service.timed?).to be(false)
|
||||
end
|
||||
|
||||
it "returns true for interval" do
|
||||
@ -421,7 +421,7 @@ describe Homebrew::Service do
|
||||
run_type :interval
|
||||
end
|
||||
|
||||
expect(f.service.timed?).to eq(true)
|
||||
expect(f.service.timed?).to be(true)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ describe Homebrew::Style do
|
||||
|
||||
style_result = described_class.check_style_and_print([target_file])
|
||||
|
||||
expect(style_result).to eq true
|
||||
expect(style_result).to be true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -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 eq(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 eq(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
|
||||
|
||||
@ -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 eq(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 eq(nil)
|
||||
expect(described_class.version).to be(nil)
|
||||
end
|
||||
|
||||
it "returns version of git when git is available" do
|
||||
|
||||
@ -137,19 +137,19 @@ describe PyPI do
|
||||
|
||||
describe ".same_package?" do
|
||||
it "returns false for different packages" do
|
||||
expect(package.same_package?(other_package)).to eq false
|
||||
expect(package.same_package?(other_package)).to be false
|
||||
end
|
||||
|
||||
it "returns true for the same package" do
|
||||
expect(package.same_package?(package_with_version)).to eq true
|
||||
expect(package.same_package?(package_with_version)).to be true
|
||||
end
|
||||
|
||||
it "returns true for the same package with different versions" do
|
||||
expect(package_with_version.same_package?(package_with_different_version)).to eq true
|
||||
expect(package_with_version.same_package?(package_with_different_version)).to be true
|
||||
end
|
||||
|
||||
it "returns true for the same package with different capitalization" do
|
||||
expect(package.same_package?(package_with_different_capitalization)).to eq true
|
||||
expect(package.same_package?(package_with_different_capitalization)).to be true
|
||||
end
|
||||
end
|
||||
|
||||
@ -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 eq 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 eq nil
|
||||
expect(described_class.update_pypi_url("https://brew.sh/foo-1.0.tgz", "1.1")).to be nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -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 eq(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 eq(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 eq(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 eq(nil)
|
||||
expect(described_class.exception_data["releaseDate"]).not_to be(nil)
|
||||
end
|
||||
|
||||
it "has exceptions" do
|
||||
@ -99,75 +99,75 @@ describe SPDX do
|
||||
|
||||
describe ".valid_license?" do
|
||||
it "returns true for valid license identifier" do
|
||||
expect(described_class.valid_license?("MIT")).to eq true
|
||||
expect(described_class.valid_license?("MIT")).to be true
|
||||
end
|
||||
|
||||
it "returns false for invalid license identifier" do
|
||||
expect(described_class.valid_license?("foo")).to eq false
|
||||
expect(described_class.valid_license?("foo")).to be false
|
||||
end
|
||||
|
||||
it "returns true for deprecated license identifier" do
|
||||
expect(described_class.valid_license?("GPL-1.0")).to eq true
|
||||
expect(described_class.valid_license?("GPL-1.0")).to be true
|
||||
end
|
||||
|
||||
it "returns true for license identifier with plus" do
|
||||
expect(described_class.valid_license?("Apache-2.0+")).to eq true
|
||||
expect(described_class.valid_license?("Apache-2.0+")).to be true
|
||||
end
|
||||
|
||||
it "returns true for :public_domain" do
|
||||
expect(described_class.valid_license?(:public_domain)).to eq true
|
||||
expect(described_class.valid_license?(:public_domain)).to be true
|
||||
end
|
||||
|
||||
it "returns true for :cannot_represent" do
|
||||
expect(described_class.valid_license?(:cannot_represent)).to eq true
|
||||
expect(described_class.valid_license?(:cannot_represent)).to be true
|
||||
end
|
||||
|
||||
it "returns false for invalid symbol" do
|
||||
expect(described_class.valid_license?(:invalid_symbol)).to eq false
|
||||
expect(described_class.valid_license?(:invalid_symbol)).to be false
|
||||
end
|
||||
end
|
||||
|
||||
describe ".deprecated_license?" do
|
||||
it "returns true for deprecated license identifier" do
|
||||
expect(described_class.deprecated_license?("GPL-1.0")).to eq true
|
||||
expect(described_class.deprecated_license?("GPL-1.0")).to be true
|
||||
end
|
||||
|
||||
it "returns true for deprecated license identifier with plus" do
|
||||
expect(described_class.deprecated_license?("GPL-1.0+")).to eq true
|
||||
expect(described_class.deprecated_license?("GPL-1.0+")).to be true
|
||||
end
|
||||
|
||||
it "returns false for non-deprecated license identifier" do
|
||||
expect(described_class.deprecated_license?("MIT")).to eq false
|
||||
expect(described_class.deprecated_license?("MIT")).to be false
|
||||
end
|
||||
|
||||
it "returns false for non-deprecated license identifier with plus" do
|
||||
expect(described_class.deprecated_license?("EPL-1.0+")).to eq false
|
||||
expect(described_class.deprecated_license?("EPL-1.0+")).to be false
|
||||
end
|
||||
|
||||
it "returns false for invalid license identifier" do
|
||||
expect(described_class.deprecated_license?("foo")).to eq false
|
||||
expect(described_class.deprecated_license?("foo")).to be false
|
||||
end
|
||||
|
||||
it "returns false for :public_domain" do
|
||||
expect(described_class.deprecated_license?(:public_domain)).to eq false
|
||||
expect(described_class.deprecated_license?(:public_domain)).to be false
|
||||
end
|
||||
|
||||
it "returns false for :cannot_represent" do
|
||||
expect(described_class.deprecated_license?(:cannot_represent)).to eq false
|
||||
expect(described_class.deprecated_license?(:cannot_represent)).to be false
|
||||
end
|
||||
end
|
||||
|
||||
describe ".valid_license_exception?" do
|
||||
it "returns true for valid license exception identifier" do
|
||||
expect(described_class.valid_license_exception?("LLVM-exception")).to eq true
|
||||
expect(described_class.valid_license_exception?("LLVM-exception")).to be true
|
||||
end
|
||||
|
||||
it "returns false for invalid license exception identifier" do
|
||||
expect(described_class.valid_license_exception?("foo")).to eq false
|
||||
expect(described_class.valid_license_exception?("foo")).to be false
|
||||
end
|
||||
|
||||
it "returns false for deprecated license exception identifier" do
|
||||
expect(described_class.valid_license_exception?("Nokia-Qt-exception-1.1")).to eq false
|
||||
expect(described_class.valid_license_exception?("Nokia-Qt-exception-1.1")).to be false
|
||||
end
|
||||
end
|
||||
|
||||
@ -275,55 +275,55 @@ describe SPDX do
|
||||
let(:license_exception) { { "MIT" => { with: "LLVM-exception" } } }
|
||||
|
||||
it "allows installation with no forbidden licenses" do
|
||||
expect(described_class.licenses_forbid_installation?("MIT", {})).to eq false
|
||||
expect(described_class.licenses_forbid_installation?("MIT", {})).to be false
|
||||
end
|
||||
|
||||
it "allows installation with non-forbidden license" do
|
||||
expect(described_class.licenses_forbid_installation?("0BSD", mit_forbidden)).to eq false
|
||||
expect(described_class.licenses_forbid_installation?("0BSD", mit_forbidden)).to be false
|
||||
end
|
||||
|
||||
it "forbids installation with forbidden license" do
|
||||
expect(described_class.licenses_forbid_installation?("MIT", mit_forbidden)).to eq true
|
||||
expect(described_class.licenses_forbid_installation?("MIT", mit_forbidden)).to be true
|
||||
end
|
||||
|
||||
it "allows installation of later license version" do
|
||||
expect(described_class.licenses_forbid_installation?("EPL-2.0", epl_1_forbidden)).to eq false
|
||||
expect(described_class.licenses_forbid_installation?("EPL-2.0", epl_1_forbidden)).to be false
|
||||
end
|
||||
|
||||
it "forbids installation of later license version with plus in forbidden license list" do
|
||||
expect(described_class.licenses_forbid_installation?("EPL-2.0", epl_1_plus_forbidden)).to eq true
|
||||
expect(described_class.licenses_forbid_installation?("EPL-2.0", epl_1_plus_forbidden)).to be true
|
||||
end
|
||||
|
||||
it "allows installation when one of the any_of licenses is allowed" do
|
||||
expect(described_class.licenses_forbid_installation?(any_of_license, mit_forbidden)).to eq false
|
||||
expect(described_class.licenses_forbid_installation?(any_of_license, mit_forbidden)).to be false
|
||||
end
|
||||
|
||||
it "forbids installation when none of the any_of licenses are allowed" do
|
||||
expect(described_class.licenses_forbid_installation?(any_of_license, multiple_forbidden)).to eq true
|
||||
expect(described_class.licenses_forbid_installation?(any_of_license, multiple_forbidden)).to be true
|
||||
end
|
||||
|
||||
it "forbids installation when one of the all_of licenses is allowed" do
|
||||
expect(described_class.licenses_forbid_installation?(all_of_license, mit_forbidden)).to eq true
|
||||
expect(described_class.licenses_forbid_installation?(all_of_license, mit_forbidden)).to be true
|
||||
end
|
||||
|
||||
it "allows installation with license + exception that aren't forbidden" do
|
||||
expect(described_class.licenses_forbid_installation?(license_exception, epl_1_forbidden)).to eq false
|
||||
expect(described_class.licenses_forbid_installation?(license_exception, epl_1_forbidden)).to be false
|
||||
end
|
||||
|
||||
it "forbids installation with license + exception that are't forbidden" do
|
||||
expect(described_class.licenses_forbid_installation?(license_exception, mit_forbidden)).to eq true
|
||||
expect(described_class.licenses_forbid_installation?(license_exception, mit_forbidden)).to be true
|
||||
end
|
||||
|
||||
it "allows installation with nested licenses with no forbidden licenses" do
|
||||
expect(described_class.licenses_forbid_installation?(nested_licenses, epl_1_forbidden)).to eq false
|
||||
expect(described_class.licenses_forbid_installation?(nested_licenses, epl_1_forbidden)).to be false
|
||||
end
|
||||
|
||||
it "allows installation with nested licenses when second hash item matches" do
|
||||
expect(described_class.licenses_forbid_installation?(nested_licenses, mit_forbidden)).to eq false
|
||||
expect(described_class.licenses_forbid_installation?(nested_licenses, mit_forbidden)).to be false
|
||||
end
|
||||
|
||||
it "forbids installation with nested licenses when all licenses are forbidden" do
|
||||
expect(described_class.licenses_forbid_installation?(nested_licenses, multiple_forbidden)).to eq true
|
||||
expect(described_class.licenses_forbid_installation?(nested_licenses, multiple_forbidden)).to be true
|
||||
end
|
||||
end
|
||||
|
||||
@ -333,23 +333,23 @@ describe SPDX do
|
||||
let(:epl_1_plus_forbidden) { { "EPL-1.0+" => described_class.license_version_info("EPL-1.0+") } }
|
||||
|
||||
it "returns false with no forbidden licenses" do
|
||||
expect(described_class.forbidden_licenses_include?("MIT", {})).to eq false
|
||||
expect(described_class.forbidden_licenses_include?("MIT", {})).to be false
|
||||
end
|
||||
|
||||
it "returns false with no matching forbidden licenses" do
|
||||
expect(described_class.forbidden_licenses_include?("MIT", epl_1_forbidden)).to eq false
|
||||
expect(described_class.forbidden_licenses_include?("MIT", epl_1_forbidden)).to be false
|
||||
end
|
||||
|
||||
it "returns true with matching license" do
|
||||
expect(described_class.forbidden_licenses_include?("MIT", mit_forbidden)).to eq true
|
||||
expect(described_class.forbidden_licenses_include?("MIT", mit_forbidden)).to be true
|
||||
end
|
||||
|
||||
it "returns false with later version of forbidden license" do
|
||||
expect(described_class.forbidden_licenses_include?("EPL-2.0", epl_1_forbidden)).to eq false
|
||||
expect(described_class.forbidden_licenses_include?("EPL-2.0", epl_1_forbidden)).to be false
|
||||
end
|
||||
|
||||
it "returns true with later version of forbidden license with later versions forbidden" do
|
||||
expect(described_class.forbidden_licenses_include?("EPL-2.0", epl_1_plus_forbidden)).to eq true
|
||||
expect(described_class.forbidden_licenses_include?("EPL-2.0", epl_1_plus_forbidden)).to be true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -223,11 +223,11 @@ describe Version do
|
||||
|
||||
describe "#empty?" do
|
||||
it "returns true if version is empty" do
|
||||
expect(described_class.create("").empty?).to eq(true)
|
||||
expect(described_class.create("").empty?).to be(true)
|
||||
end
|
||||
|
||||
it "returns false if version is not empty" do
|
||||
expect(described_class.create("1.2.3").empty?).to eq(false)
|
||||
expect(described_class.create("1.2.3").empty?).to be(false)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user