Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent NoMethodError in group update creation #9366

Merged
merged 2 commits into from Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions updater/lib/dependabot/updater/group_update_creation.rb
Expand Up @@ -340,6 +340,7 @@ def dependencies_in_existing_pr_for_group(group)
end

def deduce_updated_dependency(dependency, original_dependency)
return nil if dependency.nil? || original_dependency.nil?
return nil if original_dependency.version == dependency.version

Dependabot.logger.info(
Expand Down
Expand Up @@ -231,4 +231,30 @@
group_update_all.perform
end
end

describe "#deduce_updated_dependency" do
let(:job_definition) do
job_definition_fixture("bundler/version_updates/group_update_refresh_dependencies_changed")
end

let(:dependency_files) do
original_bundler_files
end

before do
stub_rubygems_calls
end

it "returns nil if dependency is nil" do
dependency = nil
original_dependency = dependency_snapshot.dependencies.first
expect(group_update_all.deduce_updated_dependency(dependency, original_dependency)).to eq(nil)
end

it "returns nil if original_dependency is nil" do
dependency = dependency_snapshot.dependencies.first
original_dependency = nil
expect(group_update_all.deduce_updated_dependency(dependency, original_dependency)).to eq(nil)
end
end
end