This repository has been archived by the owner on Jan 18, 2021. It is now read-only.
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 #383 from mockito/ep3
expose release notes url
- Loading branch information
Showing
4 changed files
with
70 additions
and
43 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
34 changes: 0 additions & 34 deletions
34
src/test/groovy/org/shipkit/internal/gradle/notes/tasks/UpdateReleaseNotesTaskTest.groovy
This file was deleted.
Oops, something went wrong.
55 changes: 55 additions & 0 deletions
55
src/test/groovy/org/shipkit/internal/gradle/notes/tasks/UpdateReleaseNotesTest.groovy
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package org.shipkit.internal.gradle.notes.tasks | ||
|
||
import org.gradle.testfixtures.ProjectBuilder | ||
import org.junit.Rule | ||
import org.junit.rules.TemporaryFolder | ||
import org.shipkit.gradle.notes.UpdateReleaseNotesTask | ||
import spock.lang.Specification | ||
|
||
class UpdateReleaseNotesTest extends Specification { | ||
|
||
@Rule | ||
TemporaryFolder tmp = new TemporaryFolder() | ||
|
||
UpdateReleaseNotes update = new UpdateReleaseNotes() | ||
|
||
def "should update release notes if not in preview mode"() { | ||
def f = tmp.newFile("release-notes.md") | ||
|
||
when: | ||
update.updateReleaseNotes(false, f, "content") | ||
|
||
then: | ||
f.text == "content" | ||
} | ||
|
||
def "should not modify releaseNotesFile if in preview mode"() { | ||
def f = tmp.newFile("release-notes.md") | ||
|
||
when: | ||
update.updateReleaseNotes(true, f, "content") | ||
|
||
then: | ||
f.text.isEmpty() | ||
} | ||
|
||
def "check release notes url"(branch, expectedUrl) { | ||
given: | ||
def task = Mock(UpdateReleaseNotesTask) | ||
def project = new ProjectBuilder().withName("myProject").withProjectDir(tmp.root).build() | ||
|
||
when: | ||
task.gitHubUrl >> "https://github.com" | ||
task.gitHubRepository >> 'mockito/mockito' | ||
task.project >> project | ||
task.releaseNotesFile >> project.file("doc/release-notes/official.md") | ||
|
||
then: | ||
expectedUrl == update.getReleaseNotesUrl(task, branch) | ||
|
||
where: | ||
branch | expectedUrl | ||
'master' | 'https://github.com/mockito/mockito/blob/master/doc/release-notes/official.md' | ||
'release/2.x' | 'https://github.com/mockito/mockito/blob/release/2.x/doc/release-notes/official.md' | ||
} | ||
} |