Skip to content

Commit

Permalink
Fix the result of finalize to return array
Browse files Browse the repository at this point in the history
  • Loading branch information
saturnflyer committed Jun 9, 2024
1 parent 200aef7 commit f17899f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Support for alhpa characters in version numbers
- Support for English names for Greek alphabet letters in version numbers

### Fixed

- Reissue.finalize returns the version and value as an array

## [0.1.2] - 2024-06-08

### Fixed:
Expand Down
2 changes: 1 addition & 1 deletion lib/reissue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def self.call(
def self.finalize(date = Date.today, changelog_file: "CHANGELOG.md")
changelog_updater = ChangelogUpdater.new(changelog_file)
changelog = changelog_updater.finalize(date:, changelog_file:)
changelog["versions"].first.slice("version", "date")
changelog["versions"].first.slice("version", "date").values
end

# Reformats the changelog file to ensure it is correctly formatted.
Expand Down
12 changes: 12 additions & 0 deletions test/test_reissue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ class TestReissue < Minitest::Spec

assert_match(/\[0.1.2\] - 2021-01-01/, contents)
end

it "returns the version number and release date" do
fixture_changelog = File.expand_path("fixtures/changelog.md", __dir__)
changelog_file = Tempfile.new
changelog_file << File.read(fixture_changelog)
changelog_file.close

version, date = Reissue.finalize("2021-01-01", changelog_file: changelog_file.path)

assert_equal("0.1.2", version)
assert_equal("2021-01-01", date)
end
end

describe ".reformat" do
Expand Down

0 comments on commit f17899f

Please sign in to comment.