Skip to content

Commit

Permalink
Fix release date format in DefaultChangeRenderer
Browse files Browse the repository at this point in the history
Description
===========

The renderer used a faulty format string which printed the days in year
instead of the day in month. Simple patch plus a regression test.

Changes
=======

![FIX] date formate in `DefaultChangeRenderer`
  • Loading branch information
Larusso committed Sep 16, 2019
1 parent 958723d commit adcadb4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class DefaultChangeRenderer<E extends ChangeSet<GHCommit, GHPullRequest>> implem
Set<Link> links = new HashSet<Link>()

new StringBuilder().with {
append(new Headline("${changes.name} - ${changes.date.format("YYYY-MM-D")}", 1, headlineType))
append(new Headline("${changes.name} - ${changes.date.format("YYYY-MM-dd")}", 1, headlineType))
if (!changes.pullRequests.empty) {
append(new Headline("Pull Requests", 2, headlineType))
changes.pullRequests.each { pr ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,27 @@ class DefaultChangeRendererSpec extends Specification {
pullRequestTitles.every { result.contains(it) }
}

def "renders release date in form YYYY-MM-dd"() {
given: "a renderer"
renderer = new DefaultChangeRenderer<BaseChangeSet>()

and: "a name and date for the changeset"
testChangeset.name = releaseName
testChangeset.date = releaseDate

when:
def result = renderer.render(testChangeset)

then:
noExceptionThrown()
result.contains("# ${releaseName} - ${releaseDateString}")

where:
releaseName = "TestRelease"
releaseDate = new Date(0)
releaseDateString = releaseDate.format("YYYY-MM-dd")
}

@Unroll
def "renders #linkTo links #type style"() {
given: "a renderer"
Expand Down

0 comments on commit adcadb4

Please sign in to comment.