Fix (auto-correct) RuboCop RSpec/BeNil offenses

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

View File

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

View File

@ -125,7 +125,7 @@ describe PATH do
end
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

View File

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

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
args = parser.parse([])
expect(args.positive?).to be nil
expect(args.positive?).to be_nil
end
end

View File

@ -70,7 +70,7 @@ describe Commands 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("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
specify "returns the path for an internal developer-command" do

View File

@ -65,7 +65,7 @@ describe DependencyCollector do
it "creates a resource dependency from a '.gz' URL" do
resource = Resource.new
resource.url("https://brew.sh/foo.tar.gz")
expect(collector.add(resource)).to be nil
expect(collector.add(resource)).to be_nil
end
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 =~ /\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).to include("Valid")
end

View File

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

View File

@ -47,12 +47,12 @@ describe "Exception" do
describe "#dependent_s" 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
it "returns nil if it depended on by itself" do
error.dependent = "foo"
expect(error.dependent_s).to be nil
expect(error.dependent_s).to be_nil
end
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_specified_name).to eq(name)
expect(f.path).to eq(path)
expect(f.alias_path).to be nil
expect(f.alias_name).to be nil
expect(f.full_alias_name).to be nil
expect(f.alias_path).to be_nil
expect(f.alias_name).to be_nil
expect(f.full_alias_name).to be_nil
expect(f.specified_path).to eq(path)
expect { klass.new }.to raise_error(ArgumentError)
end
@ -70,9 +70,9 @@ describe Formula do
expect(f.full_name).to eq(full_name)
expect(f.full_specified_name).to eq(full_name)
expect(f.path).to eq(path)
expect(f.alias_path).to be nil
expect(f.alias_name).to be nil
expect(f.full_alias_name).to be nil
expect(f.alias_path).to be_nil
expect(f.alias_name).to be_nil
expect(f.full_alias_name).to be_nil
expect(f.specified_path).to eq(path)
expect { klass.new }.to raise_error(ArgumentError)
end
@ -175,9 +175,9 @@ describe Formula do
]
build_values_with_no_installed_alias.each do |build|
f.build = build
expect(f.installed_alias_path).to be nil
expect(f.installed_alias_name).to be nil
expect(f.full_installed_alias_name).to be nil
expect(f.installed_alias_path).to be_nil
expect(f.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.full_installed_specified_name).to eq(f.name)
end
@ -210,9 +210,9 @@ describe Formula do
]
build_values_with_no_installed_alias.each do |build|
f.build = build
expect(f.installed_alias_path).to be nil
expect(f.installed_alias_name).to be nil
expect(f.full_installed_alias_name).to be nil
expect(f.installed_alias_path).to be_nil
expect(f.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.full_installed_specified_name).to eq(f.full_name)
end
@ -401,7 +401,7 @@ describe Formula do
end
specify "#<=>" do
expect(Testball.new <=> Object.new).to be nil
expect(Testball.new <=> Object.new).to be_nil
end
describe "#installed_alias_path" do
@ -414,7 +414,7 @@ describe Formula do
f.build = BuildOptions.new(Options.new, f.options)
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
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 })
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
example "alias paths with tab with alias source path" do
@ -580,7 +580,7 @@ describe Formula do
url "foo-1.0"
end
expect(f.head).to be nil
expect(f.head).to be_nil
end
it "honors attributes declared before specs" do
@ -1132,7 +1132,7 @@ describe Formula do
specify "alias changes when not installed with alias" do
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).not_to have_changed_installed_alias_target
expect(f).not_to supersede_an_installed_formula
@ -1526,7 +1526,7 @@ describe Formula do
end
it "returns nil when not installed" do
expect(f.any_installed_version).to be nil
expect(f.any_installed_version).to be_nil
end
it "returns package version when installed" do

View File

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

View File

@ -81,7 +81,7 @@ describe InstalledDependents do
specify "no dependencies anywhere" do
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
specify "missing Formula dependency" do
@ -93,7 +93,7 @@ describe InstalledDependents do
specify "uninstalling dependent and dependency" do
dependencies nil
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
specify "renamed dependency" do
@ -112,7 +112,7 @@ describe InstalledDependents do
specify "empty dependencies in Tab" do
dependencies []
expect(described_class.find_some_installed_dependents([keg])).to be nil
expect(described_class.find_some_installed_dependents([keg])).to be_nil
end
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
stub_formula_name("baz")
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
specify "same name and version in Tab" do
@ -140,7 +140,7 @@ describe InstalledDependents do
specify "non-opt-linked" do
keg.remove_opt_record
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
specify "keg-only" do

View File

@ -55,7 +55,7 @@ describe Keg do
end
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.make_relative_symlink(HOMEBREW_CELLAR/"foo/1.0")
expect(keg.oldname_opt_record).to eq(oldname_opt_record)

View File

@ -68,7 +68,7 @@ describe Homebrew::Livecheck::Strategy::Sparkle do
let(:item_from_appcast_xml) { sparkle.item_from_content(appcast_xml) }
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
it "returns an Item when given XML data" do

View File

@ -30,7 +30,7 @@ describe Livecheck do
describe "#formula" do
it "returns nil if not set" do
expect(livecheckable_f.formula).to be nil
expect(livecheckable_f.formula).to be_nil
end
it "returns the String if set" do
@ -47,7 +47,7 @@ describe Livecheck do
describe "#cask" do
it "returns nil if not set" do
expect(livecheckable_c.cask).to be nil
expect(livecheckable_c.cask).to be_nil
end
it "returns the String if set" do
@ -64,7 +64,7 @@ describe Livecheck do
describe "#regex" do
it "returns nil if not set" do
expect(livecheckable_f.regex).to be nil
expect(livecheckable_f.regex).to be_nil
end
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
expect(livecheckable_f.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
it "sets @skip to true and @skip_msg to the provided String" do
@ -110,7 +110,7 @@ describe Livecheck do
describe "#strategy" do
it "returns nil if not set" do
expect(livecheckable_f.strategy).to be nil
expect(livecheckable_f.strategy).to be_nil
end
it "returns the Symbol if set" do
@ -129,7 +129,7 @@ describe Livecheck do
let(:url_string) { "https://brew.sh" }
it "returns nil if not set" do
expect(livecheckable_f.url).to be nil
expect(livecheckable_f.url).to be_nil
end
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
resource.url("https://brew.sh/foo.xz")
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
it "does not create a resource dependency from a '.zip' URL" do
resource.url("https://brew.sh/foo.zip")
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
it "does not create a resource dependency from a '.bz2' URL" do
resource.url("https://brew.sh/foo.tar.bz2")
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

View File

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

View File

@ -56,12 +56,12 @@ describe PkgVersion do
describe "#<=>" do
it "returns nil if the comparison fails" do
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(described_class.new(Version.create("1.0"), 0) <=> nil).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(described_class.new(Version.create("1.0"), 0) <=> nil).to be_nil
# 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

View File

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

View File

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

View File

@ -11,6 +11,6 @@ describe HeadSoftwareSpec do
end
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

View File

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

View File

@ -64,20 +64,20 @@ describe Tab do
expect(tab.homebrew_version).to eq(HOMEBREW_VERSION)
expect(tab.unused_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_poured_from_bottle
expect(tab).to be_stable
expect(tab).not_to be_head
expect(tab.tap).to be nil
expect(tab.time).to be nil
expect(tab.HEAD).to be nil
expect(tab.runtime_dependencies).to be nil
expect(tab.stable_version).to be nil
expect(tab.head_version).to be nil
expect(tab.tap).to be_nil
expect(tab.time).to be_nil
expect(tab.HEAD).to be_nil
expect(tab.runtime_dependencies).to be_nil
expect(tab.stable_version).to be_nil
expect(tab.head_version).to be_nil
expect(tab.cxxstdlib.compiler).to eq(DevelopmentTools.default_compiler)
expect(tab.cxxstdlib.type).to be nil
expect(tab.source["path"]).to be nil
expect(tab.cxxstdlib.type).to be_nil
expect(tab.source["path"]).to be_nil
end
specify "#include?" do
@ -114,25 +114,25 @@ describe Tab do
specify "#runtime_dependencies" do
tab = described_class.new
expect(tab.runtime_dependencies).to be nil
expect(tab.runtime_dependencies).to be_nil
tab.homebrew_version = "1.1.6"
expect(tab.runtime_dependencies).to be nil
expect(tab.runtime_dependencies).to be_nil
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"
expect(tab.runtime_dependencies).to be nil
expect(tab.runtime_dependencies).to be_nil
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"
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" }]
expect(tab.runtime_dependencies).not_to be nil
expect(tab.runtime_dependencies).not_to be_nil
end
specify "::runtime_deps_hash" do
@ -232,7 +232,7 @@ describe Tab do
expect(tab.HEAD).to eq(TEST_SHA1)
expect(tab.cxxstdlib.compiler).to eq(:clang)
expect(tab.cxxstdlib.type).to eq(:libcxx)
expect(tab.runtime_dependencies).to be nil
expect(tab.runtime_dependencies).to be_nil
end
it "raises a parse exception message including the Tab filename" do
@ -331,7 +331,7 @@ describe Tab do
f.prefix.mkpath
tab = described_class.for_formula(f)
expect(tab.tabfile).to be nil
expect(tab.tabfile).to be_nil
end
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")
(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
path.parent.rmtree
end
@ -198,13 +198,13 @@ describe Tap do
end
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
it "returns nil if Git is not available" do
setup_git_repo
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
@ -240,13 +240,13 @@ describe Tap do
end
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
it "returns nil if Git is not available" do
setup_git_repo
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
@ -450,11 +450,11 @@ describe Tap do
specify "#config" do
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"
expect(homebrew_foo_tap.config["foo"]).to eq("bar")
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
describe "#each" do

View File

@ -21,12 +21,12 @@ describe Utils::Bottles::Collector do
end
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
it "returns nil when there is no match" do
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
it "uses older tags when needed", :needs_macos do

View File

@ -56,9 +56,9 @@ describe Utils::Shell do
end
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("invalid_shell-4.2")).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
end
end

View File

@ -132,7 +132,7 @@ describe "globally-scoped helper methods" do
end
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
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
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)
end
describe "#to_str" 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
@ -211,7 +211,7 @@ describe Version do
specify "comparison returns nil for non-version" do
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)
end
@ -271,7 +271,7 @@ describe Version do
specify "HEAD without commit" do
v = described_class.create("HEAD")
expect(v.commit).to be nil
expect(v.commit).to be_nil
expect(v.to_str).to eq("HEAD")
end
end
@ -326,7 +326,7 @@ describe Version do
describe "#minor" 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.3").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
it "returns patch version token" do
expect(described_class.create("1").patch).to be nil
expect(described_class.create("1.2").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.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.3alpha4").patch).to be == Version::Token.create("3")