Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 0 additions & 4 deletions updater/lib/dependabot/job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ def reject_external_code?
@reject_external_code
end

def build_pull_request_message?
experiments.fetch(:build_pull_request_message, false)
end

# rubocop:disable Metrics/PerceivedComplexity
def allowed_update?(dependency)
allowed_updates.any? do |update|
Expand Down
2 changes: 0 additions & 2 deletions updater/lib/dependabot/updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -959,8 +959,6 @@ def handle_parser_error(error)
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/CyclomaticComplexity
def pr_message(dependencies, files)
return nil unless job.build_pull_request_message?

Dependabot::PullRequestCreator::MessageBuilder.new(
source: job.source,
dependencies: dependencies,
Expand Down
3 changes: 3 additions & 0 deletions updater/spec/dependabot/integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
allow(Dependabot::Environment).to receive(:token).and_return("some_token")
allow(Dependabot::Environment).to receive(:job_id).and_return(job_id)
allow(Dependabot.logger).to receive(:info).and_call_original
message_builder = double(Dependabot::PullRequestCreator::MessageBuilder)
allow(Dependabot::PullRequestCreator::MessageBuilder).to receive(:new).and_return(message_builder)
allow(message_builder).to receive(:message).and_return(nil)
Comment thread
jakecoffman marked this conversation as resolved.
end

describe "bundler" do
Expand Down
41 changes: 18 additions & 23 deletions updater/spec/dependabot/updater_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@
to_return(status: 200, body: fixture("rubygems-info-a"))
stub_request(:get, "https://index.rubygems.org/info/dummy-pkg-b").
to_return(status: 200, body: fixture("rubygems-info-b"))

message_builder = double(Dependabot::PullRequestCreator::MessageBuilder)
allow(Dependabot::PullRequestCreator::MessageBuilder).to receive(:new).and_return(message_builder)
allow(message_builder).to receive(:message).and_return(nil)
end

let(:dependency_files) do
Expand Down Expand Up @@ -767,8 +771,20 @@ def expect_update_checker_with_ignored_versions(versions)
updater.run
end

it "does not build pull request message" do
expect(Dependabot::PullRequestCreator::MessageBuilder).not_to receive(:new)
it "builds pull request message" do
expect(Dependabot::PullRequestCreator::MessageBuilder).
to receive(:new).with(
source: job.source,
files: an_instance_of(Array),
dependencies: an_instance_of(Array),
credentials: credentials,
commit_message_options: {
include_scope: commit_message_include_scope,
prefix: commit_message_prefix,
prefix_development: commit_message_prefix_development
},
github_redirection_service: "github-redirect.dependabot.com"
)
updater.run
end

Expand Down Expand Up @@ -1608,27 +1624,6 @@ def expect_update_checker_with_ignored_versions(versions)
end
end

context "when build_pull_request_message is set" do
let(:experiments) { { "build-pull-request-message" => true } }

it "builds pull request message" do
expect(Dependabot::PullRequestCreator::MessageBuilder).
to receive(:new).with(
source: job.source,
files: an_instance_of(Array),
dependencies: an_instance_of(Array),
credentials: credentials,
commit_message_options: {
include_scope: commit_message_include_scope,
prefix: commit_message_prefix,
prefix_development: commit_message_prefix_development
},
github_redirection_service: "github-redirect.dependabot.com"
)
updater.run
end
end

describe "experiments" do
let(:experiments) do
{ "large-hadron-collider" => true }
Expand Down