Merge pull request #12937 from Homebrew/dependabot/bundler/Library/Homebrew/rubocop-rspec-2.9.0

build(deps): bump rubocop-rspec from 2.8.0 to 2.9.0 in /Library/Homebrew
This commit is contained in:
Mike McQuaid 2022-03-01 10:03:13 +00:00 committed by GitHub
commit c84cb39d04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
165 changed files with 308 additions and 189 deletions

View File

@ -141,7 +141,7 @@ GEM
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
rack (>= 1.1) rack (>= 1.1)
rubocop (>= 1.7.0, < 2.0) rubocop (>= 1.7.0, < 2.0)
rubocop-rspec (2.8.0) rubocop-rspec (2.9.0)
rubocop (~> 1.19) rubocop (~> 1.19)
rubocop-sorbet (0.6.7) rubocop-sorbet (0.6.7)
rubocop (>= 0.90.0) rubocop (>= 0.90.0)

View File

@ -112,6 +112,16 @@ end
RuboCop::Cop::RSpec::Be::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::RSpec::Be::MSG = T.let(T.unsafe(nil), String)
class RuboCop::Cop::RSpec::BeEq < ::RuboCop::Cop::RSpec::Base
extend ::RuboCop::Cop::AutoCorrector
def eq_type_with_identity?(param0 = T.unsafe(nil)); end
def on_send(node); end
end
RuboCop::Cop::RSpec::BeEq::MSG = T.let(T.unsafe(nil), String)
RuboCop::Cop::RSpec::BeEq::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
class RuboCop::Cop::RSpec::BeEql < ::RuboCop::Cop::RSpec::Base class RuboCop::Cop::RSpec::BeEql < ::RuboCop::Cop::RSpec::Base
extend ::RuboCop::Cop::AutoCorrector extend ::RuboCop::Cop::AutoCorrector
@ -122,6 +132,16 @@ end
RuboCop::Cop::RSpec::BeEql::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::RSpec::BeEql::MSG = T.let(T.unsafe(nil), String)
RuboCop::Cop::RSpec::BeEql::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) RuboCop::Cop::RSpec::BeEql::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
class RuboCop::Cop::RSpec::BeNil < ::RuboCop::Cop::RSpec::Base
extend ::RuboCop::Cop::AutoCorrector
def nil_value_expectation?(param0 = T.unsafe(nil)); end
def on_send(node); end
end
RuboCop::Cop::RSpec::BeNil::MSG = T.let(T.unsafe(nil), String)
RuboCop::Cop::RSpec::BeNil::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
class RuboCop::Cop::RSpec::BeforeAfterAll < ::RuboCop::Cop::RSpec::Base class RuboCop::Cop::RSpec::BeforeAfterAll < ::RuboCop::Cop::RSpec::Base
def before_or_after_all(param0 = T.unsafe(nil)); end def before_or_after_all(param0 = T.unsafe(nil)); end
def on_send(node); end def on_send(node); end

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

@ -53,12 +53,12 @@ describe Homebrew::API::Bottle do
describe "::available?" do describe "::available?" do
it "returns `true` if `fetch` succeeds" do it "returns `true` if `fetch` succeeds" do
allow(described_class).to receive(:fetch) allow(described_class).to receive(:fetch)
expect(described_class.available?("foo")).to eq true expect(described_class.available?("foo")).to be true
end end
it "returns `false` if `fetch` fails" do it "returns `false` if `fetch` fails" do
allow(described_class).to receive(:fetch).and_raise ArgumentError 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
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

@ -107,7 +107,7 @@ describe Caveats do
end end
caveats = described_class.new(f).caveats 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("#{f.bin}/php test")
expect(caveats).to include("background service") expect(caveats).to include("background service")
end end

View File

@ -18,6 +18,6 @@ describe Checksum do
it { is_expected.to eq(other) } it { is_expected.to eq(other) }
it { is_expected.not_to eq(other_reversed) } it { is_expected.not_to eq(other_reversed) }
it { is_expected.not_to eq(nil) } it { is_expected.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

@ -207,9 +207,9 @@ describe Homebrew::Completions do
it "handles --[no]- options correctly" do it "handles --[no]- options correctly" do
options = described_class.command_options("audit") options = described_class.command_options("audit")
expect(options.key?("--appcast")).to eq true expect(options.key?("--appcast")).to be true
expect(options.key?("--no-appcast")).to eq true expect(options.key?("--no-appcast")).to be true
expect(options["--appcast"] == options["--no-appcast"]).to eq true expect(options["--appcast"] == options["--no-appcast"]).to be true
end end
it "return an empty array if command is not found" do it "return an empty array if command is not found" do
@ -228,15 +228,15 @@ describe Homebrew::Completions do
describe ".command_gets_completions?" do describe ".command_gets_completions?" do
it "returns true for a non-cask command with options" 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 end
it "returns false for a non-cask command with no options" do 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 end
it "returns false for a cask command" do 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
end end

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
@ -719,7 +719,7 @@ describe Formula do
url "https://brew.sh/test-1.0.tbz" url "https://brew.sh/test-1.0.tbz"
end end
expect(f.service).to eq(nil) expect(f.service).to be_nil
end end
specify "service complicated" do specify "service complicated" do
@ -735,7 +735,7 @@ describe Formula do
working_dir var working_dir var
keep_alive true keep_alive true
end end
expect(f.service).not_to eq(nil) expect(f.service).not_to be_nil
end end
specify "service uses simple run" do specify "service uses simple run" do
@ -746,7 +746,7 @@ describe Formula do
end end
end end
expect(f.service).not_to eq(nil) expect(f.service).not_to be_nil
end end
specify "service helpers return data" do specify "service helpers return data" 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
@ -173,7 +173,7 @@ describe InstalledDependents do
specify "identify dependent casks" do specify "identify dependent casks" do
setup_test_cask("qux", "1.0.0", "foo") setup_test_cask("qux", "1.0.0", "foo")
dependents = described_class.find_some_installed_dependents([keg]).last 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 end
end end

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

@ -16,7 +16,7 @@ describe Language::Node do
described_class.instance_variable_set(:@env_set, false) described_class.instance_variable_set(:@env_set, false)
expect(described_class.setup_npm_environment).to be_nil 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(ENV).not_to receive(:prepend_path)
expect(described_class.setup_npm_environment).to be_nil expect(described_class.setup_npm_environment).to be_nil
end end

View File

@ -142,10 +142,10 @@ describe Homebrew::Livecheck do
end end
it "returns nil when not given a string or valid symbol" do 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, f_livecheck_url)).to be_nil
expect(livecheck.livecheck_url_to_string(nil, c_livecheck_url)).to eq(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 eq(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 eq(nil) expect(livecheck.livecheck_url_to_string(:invalid_symbol, c_livecheck_url)).to be_nil
end end
end end

View File

@ -458,11 +458,11 @@ describe Homebrew::Livecheck::SkipConditions do
end end
it "returns an empty hash for a non-skippable formula" do 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 end
it "returns an empty hash for a non-skippable cask" do 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
end end

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

@ -54,7 +54,7 @@ describe Formula do
expect(f.class.stable.deps[0].name).to eq("hello_both") 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[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 end
it "adds a patch on Linux only" do it "adds a patch on Linux only" do

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

@ -59,7 +59,7 @@ describe Formula do
expect(f.class.stable.deps[0].name).to eq("hello_both") 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[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 end
it "adds a patch on Mac only" do it "adds a patch on Mac only" do

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

@ -412,7 +412,7 @@ describe Homebrew::Service do
run_type :immediate run_type :immediate
end end
expect(f.service.timed?).to eq(false) expect(f.service.timed?).to be(false)
end end
it "returns true for interval" do it "returns true for interval" do
@ -421,7 +421,7 @@ describe Homebrew::Service do
run_type :interval run_type :interval
end end
expect(f.service.timed?).to eq(true) expect(f.service.timed?).to be(true)
end end
end end

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

@ -47,7 +47,7 @@ describe Homebrew::Style do
style_result = described_class.check_style_and_print([target_file]) 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 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

@ -7,7 +7,7 @@ describe Utils do
shared_examples "git_repository helper function" do |method_name| shared_examples "git_repository helper function" do |method_name|
context "when directory is not a Git repository" do context "when directory is not a Git repository" do
it "returns nil if `safe` parameter is `false`" 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 end
it "raises an error if `safe` parameter is `true`" do it "raises an error if `safe` parameter is `true`" do
@ -22,7 +22,7 @@ describe Utils do
end end
it "returns nil if `safe` parameter is `false`" do 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 end
it "raises an error if `safe` parameter is `true`" do it "raises an error if `safe` parameter is `true`" do

View File

@ -142,7 +142,7 @@ describe Utils::Git do
describe "::path" do describe "::path" do
it "returns nil when git is not available" do it "returns nil when git is not available" do
stub_const("HOMEBREW_SHIMS_PATH", HOMEBREW_PREFIX/"bin/shim") stub_const("HOMEBREW_SHIMS_PATH", HOMEBREW_PREFIX/"bin/shim")
expect(described_class.path).to eq(nil) expect(described_class.path).to be_nil
end end
it "returns path of git when git is available" do it "returns path of git when git is available" do
@ -153,7 +153,7 @@ describe Utils::Git do
describe "::version" do describe "::version" do
it "returns nil when git is not available" do it "returns nil when git is not available" do
stub_const("HOMEBREW_SHIMS_PATH", HOMEBREW_PREFIX/"bin/shim") stub_const("HOMEBREW_SHIMS_PATH", HOMEBREW_PREFIX/"bin/shim")
expect(described_class.version).to eq(nil) expect(described_class.version).to be_nil
end end
it "returns version of git when git is available" do it "returns version of git when git is available" do

View File

@ -137,19 +137,19 @@ describe PyPI do
describe ".same_package?" do describe ".same_package?" do
it "returns false for different packages" 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 end
it "returns true for the same package" do 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 end
it "returns true for the same package with different versions" do 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 end
it "returns true for the same package with different capitalization" do 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
end end
@ -174,11 +174,11 @@ describe PyPI do
end end
it "returns nil for invalid versions" do 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 end
it "returns nil for non-pypi urls" do 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 end
end end

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

@ -6,11 +6,11 @@ require "utils/spdx"
describe SPDX do describe SPDX do
describe ".license_data" do describe ".license_data" do
it "has the license list version" 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 end
it "has the release date" do 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 end
it "has licenses" do it "has licenses" do
@ -20,11 +20,11 @@ describe SPDX do
describe ".exception_data" do describe ".exception_data" do
it "has the license list version" 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 end
it "has the release date" do 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 end
it "has exceptions" do it "has exceptions" do
@ -99,75 +99,75 @@ describe SPDX do
describe ".valid_license?" do describe ".valid_license?" do
it "returns true for valid license identifier" 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 end
it "returns false for invalid license identifier" do 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 end
it "returns true for deprecated license identifier" do 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 end
it "returns true for license identifier with plus" do 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 end
it "returns true for :public_domain" do 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 end
it "returns true for :cannot_represent" do 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 end
it "returns false for invalid symbol" do 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
end end
describe ".deprecated_license?" do describe ".deprecated_license?" do
it "returns true for deprecated license identifier" 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 end
it "returns true for deprecated license identifier with plus" do 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 end
it "returns false for non-deprecated license identifier" do 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 end
it "returns false for non-deprecated license identifier with plus" do 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 end
it "returns false for invalid license identifier" do 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 end
it "returns false for :public_domain" do 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 end
it "returns false for :cannot_represent" do 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
end end
describe ".valid_license_exception?" do describe ".valid_license_exception?" do
it "returns true for valid license exception identifier" 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 end
it "returns false for invalid license exception identifier" do 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 end
it "returns false for deprecated license exception identifier" do 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
end end
@ -275,55 +275,55 @@ describe SPDX do
let(:license_exception) { { "MIT" => { with: "LLVM-exception" } } } let(:license_exception) { { "MIT" => { with: "LLVM-exception" } } }
it "allows installation with no forbidden licenses" do 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 end
it "allows installation with non-forbidden license" do 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 end
it "forbids installation with forbidden license" do 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 end
it "allows installation of later license version" do 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 end
it "forbids installation of later license version with plus in forbidden license list" do 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 end
it "allows installation when one of the any_of licenses is allowed" do 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 end
it "forbids installation when none of the any_of licenses are allowed" do 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 end
it "forbids installation when one of the all_of licenses is allowed" do 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 end
it "allows installation with license + exception that aren't forbidden" do 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 end
it "forbids installation with license + exception that are't forbidden" do 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 end
it "allows installation with nested licenses with no forbidden licenses" do 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 end
it "allows installation with nested licenses when second hash item matches" do 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 end
it "forbids installation with nested licenses when all licenses are forbidden" do 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
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+") } } let(:epl_1_plus_forbidden) { { "EPL-1.0+" => described_class.license_version_info("EPL-1.0+") } }
it "returns false with no forbidden licenses" do 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 end
it "returns false with no matching forbidden licenses" do 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 end
it "returns true with matching license" do 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 end
it "returns false with later version of forbidden license" do 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 end
it "returns true with later version of forbidden license with later versions forbidden" do 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 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
@ -223,11 +223,11 @@ describe Version do
describe "#empty?" do describe "#empty?" do
it "returns true if version is 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 end
it "returns false if version is not empty" do 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
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")

View File

@ -87,7 +87,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.25.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.25.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.13.2/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.13.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.13.2/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.13.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.8.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.9.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.6.7/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.6.7/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-3.0.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-3.0.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov-html-0.12.3/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov-html-0.12.3/lib"

View File

@ -142,12 +142,24 @@ RSpec/Be:
StyleGuide: https://rspec.rubystyle.guide/#be-matcher StyleGuide: https://rspec.rubystyle.guide/#be-matcher
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Be Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Be
RSpec/BeEq:
Description: Check for expectations where `be(...)` can replace `eq(...)`.
Enabled: pending
VersionAdded: 2.9.0
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEq
RSpec/BeEql: RSpec/BeEql:
Description: Check for expectations where `be(...)` can replace `eql(...)`. Description: Check for expectations where `be(...)` can replace `eql(...)`.
Enabled: true Enabled: true
VersionAdded: '1.7' VersionAdded: '1.7'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEql Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEql
RSpec/BeNil:
Description: Check that `be_nil` is used instead of `be(nil)`.
Enabled: pending
VersionAdded: 2.9.0
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeNil
RSpec/BeforeAfterAll: RSpec/BeforeAfterAll:
Description: Check that before/after(:all) isn't being used. Description: Check that before/after(:all) isn't being used.
Enabled: true Enabled: true

View File

@ -0,0 +1,45 @@
# frozen_string_literal: true
module RuboCop
module Cop
module RSpec
# Check for expectations where `be(...)` can replace `eq(...)`.
#
# The `be` matcher compares by identity while the `eq` matcher compares
# using `==`. Booleans and nil can be compared by identity and therefore
# the `be` matcher is preferable as it is a more strict test.
#
# @example
#
# # bad
# expect(foo).to eq(true)
# expect(foo).to eq(false)
# expect(foo).to eq(nil)
#
# # good
# expect(foo).to be(true)
# expect(foo).to be(false)
# expect(foo).to be(nil)
#
class BeEq < Base
extend AutoCorrector
MSG = 'Prefer `be` over `eq`.'
RESTRICT_ON_SEND = %i[eq].freeze
# @!method eq_type_with_identity?(node)
def_node_matcher :eq_type_with_identity?, <<-PATTERN
(send nil? :eq {true false nil})
PATTERN
def on_send(node)
return unless eq_type_with_identity?(node)
add_offense(node.loc.selector) do |corrector|
corrector.replace(node.loc.selector, 'be')
end
end
end
end
end
end

View File

@ -43,7 +43,7 @@ module RuboCop
# @!method eql_type_with_identity(node) # @!method eql_type_with_identity(node)
def_node_matcher :eql_type_with_identity, <<-PATTERN def_node_matcher :eql_type_with_identity, <<-PATTERN
(send _ :to $(send nil? :eql {true false int float sym nil_type?})) (send _ :to $(send nil? :eql {true false int float sym nil}))
PATTERN PATTERN
def on_send(node) def on_send(node)

View File

@ -0,0 +1,40 @@
# frozen_string_literal: true
module RuboCop
module Cop
module RSpec
# Check that `be_nil` is used instead of `be(nil)`.
#
# RSpec has a built-in `be_nil` matcher specifically for expecting `nil`.
# For consistent specs, we recommend using that instead of `be(nil)`.
#
# @example
#
# # bad
# expect(foo).to be(nil)
#
# # good
# expect(foo).to be_nil
#
class BeNil < Base
extend AutoCorrector
MSG = 'Prefer `be_nil` over `be(nil)`.'
RESTRICT_ON_SEND = %i[be].freeze
# @!method nil_value_expectation?(node)
def_node_matcher :nil_value_expectation?, <<-PATTERN
(send nil? :be nil)
PATTERN
def on_send(node)
return unless nil_value_expectation?(node)
add_offense(node) do |corrector|
corrector.replace(node.loc.expression, 'be_nil')
end
end
end
end
end
end

Some files were not shown because too many files have changed in this diff Show More