Skip to content

Commit

Permalink
updated specs according to the changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
kbukum1 committed Aug 21, 2024
1 parent b8188ca commit 9c96ce1
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,23 @@
description: "Dependabot will stop supporting `bundler v1`!\n" \
"Please upgrade to one of the following versions: `v2`, or `v3`.\n",
markdown: "> [!WARNING]\n> Dependabot will stop supporting `bundler v1`!\n>\n" \
"> Please upgrade to one of the following versions: `v2`, or `v3`.\n>\n"
"> Please upgrade to one of the following versions: `v2`, or `v3`.\n>\n",
show_in_pr: true,
show_in_alerts: true
).to_hash
]
)
end

before do
allow(Dependabot::Experiments).to receive(:enabled?).with(:add_deprecation_warn_to_pr_message).and_return(true)
allow(Dependabot::Experiments).to receive(:enabled?).with(:add_deprecation_warn_to_log).and_return(true)
allow(Dependabot::Experiments).to receive(:enabled?).with(:add_deprecation_warn_to_alerts).and_return(true)

allow(Dependabot::UpdateCheckers).to receive(:for_package_manager).and_return(stub_update_checker_class)
allow(Dependabot::DependencyChangeBuilder)
.to receive(:create_from)
.and_return(stub_dependency_change)
allow(Dependabot::Experiments).to receive(:enabled?).with(:add_deprecation_warn_to_pr_message).and_return(true)
end

after do
Expand Down Expand Up @@ -167,7 +172,9 @@
description: "Dependabot will stop supporting `bundler v1`!\n" \
"Please upgrade to one of the following versions: `v2`, or `v3`.\n",
markdown: "> [!WARNING]\n> Dependabot will stop supporting `bundler v1`!\n>\n" \
"> Please upgrade to one of the following versions: `v2`, or `v3`.\n>\n"
"> Please upgrade to one of the following versions: `v2`, or `v3`.\n>\n",
show_in_pr: true,
show_in_alerts: true
}
)
create_group_update_pull_request.perform
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ def support_later_versions?
let(:mock_package_manager_instance) { concrete_package_manager_class.new }

before do
allow(Dependabot::Experiments).to receive(:enabled?).with(:add_deprecation_warn_to_pr_message).and_return(true)
allow(Dependabot::Experiments).to receive(:enabled?).with(:add_deprecation_warn_to_log).and_return(true)
allow(Dependabot::Experiments).to receive(:enabled?).with(:add_deprecation_warn_to_alerts).and_return(true)

# Allow for_package_manager to return the stub_update_checker_class
allow(Dependabot::UpdateCheckers).to receive(:for_package_manager).and_return(stub_update_checker_class)

Expand All @@ -219,8 +223,6 @@ def support_later_versions?
allow(dependency_snapshot)
.to receive(:package_manager)
.and_return(mock_package_manager_instance)

allow(Dependabot::Experiments).to receive(:enabled?).with(:add_deprecation_warn_to_pr_message).and_return(true)
end

after do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,14 @@
end

before do
allow(Dependabot::Experiments).to receive(:enabled?).with(:add_deprecation_warn_to_pr_message).and_return(true)
allow(Dependabot::Experiments).to receive(:enabled?).with(:add_deprecation_warn_to_log).and_return(true)
allow(Dependabot::Experiments).to receive(:enabled?).with(:add_deprecation_warn_to_alerts).and_return(true)

allow(Dependabot::UpdateCheckers).to receive(:for_package_manager).and_return(stub_update_checker_class)
allow(Dependabot::DependencyChangeBuilder)
.to receive(:create_from)
.and_return(stub_dependency_change)
allow(Dependabot::Experiments).to receive(:enabled?).with(:add_deprecation_warn_to_pr_message).and_return(true)
end

after do
Expand Down Expand Up @@ -210,7 +213,9 @@
description: "Dependabot will stop supporting `bundler v1`!\n" \
"Please upgrade to one of the following versions: `v2`, or `v3`.\n",
markdown: "> [!WARNING]\n> Dependabot will stop supporting `bundler v1`!\n>\n" \
"> Please upgrade to one of the following versions: `v2`, or `v3`.\n>\n"
"> Please upgrade to one of the following versions: `v2`, or `v3`.\n>\n",
show_in_pr: true,
show_in_alerts: true
}])
expect(refresh_security_update_pull_request).to receive(:create_pull_request)
refresh_security_update_pull_request.send(:check_and_update_pull_request, [dependency])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,15 @@ def initialize(name:, version:, deprecated_versions: [], unsupported_versions: [
end

before do
allow(Dependabot::Experiments).to receive(:enabled?).with(:add_deprecation_warn_to_pr_message).and_return(true)
allow(Dependabot::Experiments).to receive(:enabled?).with(:add_deprecation_warn_to_log).and_return(true)
allow(Dependabot::Experiments).to receive(:enabled?).with(:add_deprecation_warn_to_alerts).and_return(true)

allow(Dependabot::UpdateCheckers).to receive(:for_package_manager).and_return(stub_update_checker_class)
allow(Dependabot::DependencyChangeBuilder)
.to receive(:create_from)
.and_return(stub_dependency_change)
allow(dependency_snapshot).to receive(:package_manager).and_return(package_manager)
allow(Dependabot::Experiments).to receive(:enabled?).with(
:add_deprecation_warn_to_pr_message
).and_return(true)
end

after do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ def initialize(name:, version:, deprecated_versions: [], unsupported_versions: [
end

before do
allow(Dependabot::Experiments).to receive(:enabled?).with(:add_deprecation_warn_to_pr_message).and_return(true)
allow(Dependabot::Experiments).to receive(:enabled?).with(:add_deprecation_warn_to_log).and_return(true)
allow(Dependabot::Experiments).to receive(:enabled?).with(:add_deprecation_warn_to_alerts).and_return(true)

allow(Dependabot::UpdateCheckers).to receive(
:for_package_manager
).and_return(stub_update_checker_class)
Expand All @@ -161,9 +165,6 @@ def initialize(name:, version:, deprecated_versions: [], unsupported_versions: [
allow(dependency_snapshot).to receive(
:package_manager
).and_return(package_manager)
allow(Dependabot::Experiments).to receive(:enabled?).with(
:add_deprecation_warn_to_pr_message
).and_return(true)
end

after do
Expand Down
3 changes: 3 additions & 0 deletions updater/spec/dependabot/updater/pull_request_helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ def supported_versions

before do
allow(Dependabot::Experiments).to receive(:enabled?).with(:add_deprecation_warn_to_pr_message).and_return(true)
allow(Dependabot::Experiments).to receive(:enabled?).with(:add_deprecation_warn_to_log).and_return(true)
allow(Dependabot::Experiments).to receive(:enabled?).with(:add_deprecation_warn_to_alerts).and_return(true)

allow(service).to receive(:record_update_job_warn)
end

Expand Down

0 comments on commit 9c96ce1

Please sign in to comment.