Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions updater/lib/dependabot/dependency_change.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ def initialize(job:, dependencies:, updated_dependency_files:, group_rule: nil)
end

def pr_message
# If we are updating an existing PullRequest, we do not generate a new message as part of the change
return nil if job.updating_a_pull_request?
return @pr_message if defined?(@pr_message)

@pr_message = Dependabot::PullRequestCreator::MessageBuilder.new(
Expand Down
38 changes: 10 additions & 28 deletions updater/spec/dependabot/dependency_change_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,35 +92,17 @@
allow(Dependabot::PullRequestCreator::MessageBuilder).to receive(:new).and_return(message_builder_mock)
end

context "when the change is for a new pull request" do
before do
allow(job).to receive(:updating_a_pull_request?).and_return(false)
end

it "delegates to the Dependabot::PullRequestCreator::MessageBuilder with the correct configuration" do
expect(Dependabot::PullRequestCreator::MessageBuilder).
to receive(:new).with(
source: github_source,
files: updated_dependency_files,
dependencies: dependencies,
credentials: job_credentials,
commit_message_options: commit_message_options
)

expect(dependency_change.pr_message).to eql("Hello World!")
end
end

context "when the change is updating an existing pull request" do
before do
allow(job).to receive(:updating_a_pull_request?).and_return(true)
end

it "it does not invoke Dependabot::PullRequestCreator::MessageBuilder" do
expect(Dependabot::PullRequestCreator::MessageBuilder).not_to receive(:new)
it "delegates to the Dependabot::PullRequestCreator::MessageBuilder with the correct configuration" do
expect(Dependabot::PullRequestCreator::MessageBuilder).
to receive(:new).with(
source: github_source,
files: updated_dependency_files,
dependencies: dependencies,
credentials: job_credentials,
commit_message_options: commit_message_options
)

expect(dependency_change.pr_message).to be_nil
end
expect(dependency_change.pr_message).to eql("Hello World!")
end
end

Expand Down