Skip to content

Commit

Permalink
Enable RSpec/BeEq
Browse files Browse the repository at this point in the history
  • Loading branch information
robaiken committed May 20, 2024
1 parent ac97d9a commit 4edc94f
Show file tree
Hide file tree
Showing 69 changed files with 506 additions and 511 deletions.
5 changes: 0 additions & 5 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ RSpec/AnyInstance:
- 'updater/spec/dependabot/dependency_change_builder_spec.rb'
- 'updater/spec/dependabot/file_fetcher_command_spec.rb'

# Offense count: 506
# This cop supports unsafe autocorrection (--autocorrect-all).
RSpec/BeEq:
Enabled: false

# Offense count: 12
# This cop supports unsafe autocorrection (--autocorrect-all).
RSpec/BeEql:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,32 +31,32 @@

context "when the file does not include the dependency" do
let(:dependency_name) { "dependabot-core" }
it { is_expected.to eq(false) }
it { is_expected.to be(false) }
end

context "when the file is just comments" do
let(:gemfile) do
Dependabot::DependencyFile.new(content: "#Lol this is just a comment", name: "Gemfile")
end
it { is_expected.to eq(false) }
it { is_expected.to be(false) }
end

context "when the file does include the dependency" do
let(:dependency_name) { "business" }
it { is_expected.to eq(true) }
it { is_expected.to be(true) }

context "when it's in a source block" do
let(:gemfile) { bundler_project_dependency_file("sidekiq_pro", filename: "Gemfile") }
let(:dependency_name) { "sidekiq-pro" }

it { is_expected.to eq(true) }
it { is_expected.to be(true) }
end

context "when it's in a group block" do
let(:gemfile) { bundler_project_dependency_file("development_dependencies", filename: "Gemfile") }
let(:dependency_name) { "business" }

it { is_expected.to eq(true) }
it { is_expected.to be(true) }
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,27 @@

context "when the file does not include the dependency" do
let(:dependency_name) { "dependabot-core" }
it { is_expected.to eq(false) }
it { is_expected.to be(false) }
end

context "when the file does include the dependency as `add_dependency`" do
let(:dependency_name) { "excon" }
it { is_expected.to eq(true) }
it { is_expected.to be(true) }
end

context "when the file does include the dependency as `add_runtime_dependency`" do
let(:dependency_name) { "bundler" }
it { is_expected.to eq(true) }
it { is_expected.to be(true) }
end

context "when the file does include the dependency as `add_development_dependency`" do
let(:dependency_name) { "webmock" }
it { is_expected.to eq(true) }
it { is_expected.to be(true) }
end

context "when the file loads the dependency dynamically" do
let(:dependency_name) { "rake" }
it { is_expected.to eq(false) }
it { is_expected.to be(false) }
end
end
end
2 changes: 1 addition & 1 deletion bundler/spec/dependabot/bundler/file_parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@
it "includes the path dependency's sub-dependency" do
sub_dep = dependencies.find { |dep| dep.name == "i18n" }
expect(sub_dep.requirements).to eq([])
expect(sub_dep.top_level?).to eq(false)
expect(sub_dep.top_level?).to be(false)
end

context "when that comes from a .specification file" do
Expand Down
20 changes: 10 additions & 10 deletions bundler/spec/dependabot/bundler/update_checker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
it "respects the pin" do
expect(checker.latest_version).to eq(current_version)
expect(checker.can_update?(requirements_to_unlock: :own))
.to eq(false)
.to be(false)
end
end

Expand Down Expand Up @@ -852,7 +852,7 @@
expect(checker.latest_resolvable_version)
.to eq("a1b78a929dac93a52f08db4f2847d76d6cfe39bd")
expect(checker.can_update?(requirements_to_unlock: :own))
.to eq(false)
.to be(false)
end
end

Expand Down Expand Up @@ -1802,12 +1802,12 @@
[{ file: "Gemfile", requirement: ">= 0", groups: [], source: nil }]
end

it { is_expected.to eq(true) }
it { is_expected.to be(true) }

context "when the lockfile-only requirements update strategy is set" do
let(:requirements_update_strategy) { Dependabot::RequirementsUpdateStrategy::LockfileOnly }

it { is_expected.to eq(true) }
it { is_expected.to be(true) }
end
end

Expand All @@ -1817,7 +1817,7 @@
let(:dependency_name) { "i18n" }
let(:current_version) { "0.7.0.beta1" }

it { is_expected.to eq(true) }
it { is_expected.to be(true) }
end

context "with a Gemfile dependency that can be unlocked" do
Expand All @@ -1827,19 +1827,19 @@
end
let(:req) { "~> 1.4.0" }

it { is_expected.to eq(true) }
it { is_expected.to be(true) }

context "with multiple requirements" do
let(:dependency_files) { bundler_project_dependency_files("version_between_bounds_gemfile") }
let(:req) { "> 1.0.0, < 1.5.0" }

it { is_expected.to eq(true) }
it { is_expected.to be(true) }
end

context "when the lockfile-only requirements update strategy is set" do
let(:requirements_update_strategy) { Dependabot::RequirementsUpdateStrategy::LockfileOnly }

it { is_expected.to eq(false) }
it { is_expected.to be(false) }
end
end

Expand All @@ -1860,7 +1860,7 @@
}]
end

it { is_expected.to eq(true) }
it { is_expected.to be(true) }
end

context "with a Gemfile with a function version" do
Expand All @@ -1869,7 +1869,7 @@
[{ file: "Gemfile", requirement: "1.0.0", groups: [], source: nil }]
end

it { is_expected.to eq(false) }
it { is_expected.to be(false) }
end
end
end
2 changes: 1 addition & 1 deletion cargo/spec/dependabot/cargo/file_fetcher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@
expect(file_fetcher_instance.files.map(&:name))
.to match_array(%w(Cargo.toml .cargo/config.toml src/s3/Cargo.toml))
expect(file_fetcher_instance.files.last.support_file?)
.to eq(true)
.to be(true)
end

context "with a trailing slash in the path" do
Expand Down
4 changes: 2 additions & 2 deletions cargo/spec/dependabot/cargo/update_checker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -492,12 +492,12 @@
describe "#requirements_unlocked_or_can_be?" do
subject { checker.requirements_unlocked_or_can_be? }

it { is_expected.to eq(true) }
it { is_expected.to be(true) }

context "with the lockfile-only requirements update strategy set" do
let(:requirements_update_strategy) { Dependabot::RequirementsUpdateStrategy::LockfileOnly }

it { is_expected.to eq(false) }
it { is_expected.to be(false) }
end
end
end
10 changes: 5 additions & 5 deletions cargo/spec/dependabot/cargo/version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@

context "with a valid version" do
let(:version_string) { "1.0.0" }
it { is_expected.to eq(true) }
it { is_expected.to be(true) }
end

context "with an invalid version" do
let(:version_string) { "0.9.0" }
it { is_expected.to eq(false) }
it { is_expected.to be(false) }
end

context "with a valid prerelease version" do
let(:version_string) { "1.1.0-pre" }
it { is_expected.to eq(true) }
it { is_expected.to be(true) }
end
end

Expand All @@ -80,15 +80,15 @@
valid.each do |version|
context "with version #{version}" do
let(:version_string) { version }
it { is_expected.to eq(true) }
it { is_expected.to be(true) }
end
end

invalid = %w( questionmark?)
invalid.each do |version|
context "with version #{version}" do
let(:version_string) { version }
it { is_expected.to eq(false) }
it { is_expected.to be(false) }
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions common/spec/dependabot/config/ignore_condition_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def expect_allowed(versions)
versions.each do |v|
version = Dependabot::Utils.version_class_for_package_manager(package_manager).new(v)
ignored = reqs.any? { |req| req.satisfied_by?(version) }
expect(ignored).to eq(false), "Expected #{v} to be allowed, but was ignored"
expect(ignored).to be(false), "Expected #{v} to be allowed, but was ignored"
end
end

Expand All @@ -38,7 +38,7 @@ def expect_ignored(versions)
versions.each do |v|
version = Dependabot::Version.new(v)
ignored = reqs.any? { |req| req.satisfied_by?(version) }
expect(ignored).to eq(true), "Expected #{v} to be ignored, but was allowed"
expect(ignored).to be(true), "Expected #{v} to be ignored, but was allowed"
end
end

Expand Down

0 comments on commit 4edc94f

Please sign in to comment.