-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from alphagov/fix-subdependency-edge-case
Fix dependency name edge-case
- Loading branch information
Showing
2 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,26 @@ def single_dependency_commit | |
TEXT | ||
end | ||
|
||
def single_external_dependency_commit | ||
<<~TEXT | ||
Bump shoulda-matchers from 5.3.0 to 6.0.0 | ||
Bumps [shoulda-matchers](https://github.com/thoughtbot/shoulda-matchers) from 5.3.0 to 6.0.0. | ||
- [Release notes](https://github.com/thoughtbot/shoulda-matchers/releases) | ||
- [Changelog](https://github.com/thoughtbot/shoulda-matchers/blob/main/CHANGELOG.md) | ||
- [Commits](thoughtbot/[email protected]) | ||
--- | ||
updated-dependencies: | ||
- dependency-name: shoulda-matchers | ||
dependency-type: direct:development | ||
update-type: version-update:semver-major | ||
... | ||
Signed-off-by: dependabot[bot] <[email protected]> | ||
TEXT | ||
end | ||
|
||
def multiple_dependencies_commit | ||
<<~TEXT | ||
Bump rack, rails and govuk_sidekiq | ||
|
@@ -512,6 +532,31 @@ def create_mock_dependency_manager | |
) | ||
pull_request.tell_dependency_manager_what_dependabot_is_changing | ||
end | ||
|
||
it "supports hyphenated names" do | ||
dependency_manager = double("DependencyManager") | ||
api_response = "foo" | ||
pull_request = PullRequest.new(api_response, dependency_manager) | ||
allow(pull_request).to receive(:commit_message).and_return(single_external_dependency_commit) | ||
allow(pull_request).to receive(:gemfile_lock_changes).and_return( | ||
<<~GEMFILE_LOCK_DIFF, | ||
- shoulda-matchers (5.3.0) | ||
+ shoulda-matchers (6.0.0) | ||
GEMFILE_LOCK_DIFF | ||
) | ||
|
||
expect(dependency_manager).to receive(:remove_dependency).with( | ||
name: "shoulda-matchers", | ||
version: "5.3.0", | ||
) | ||
|
||
expect(dependency_manager).to receive(:add_dependency).with( | ||
name: "shoulda-matchers", | ||
version: "6.0.0", | ||
) | ||
|
||
pull_request.tell_dependency_manager_what_dependabot_is_changing | ||
end | ||
end | ||
|
||
describe "#merge!" do | ||
|