Skip to content

Commit

Permalink
(#3) Added ability to specify descriptions for releases
Browse files Browse the repository at this point in the history
* Fixed branch coverage
* Left puzzle on new test due to impediment on jcabi-github
  • Loading branch information
llorllale committed Mar 13, 2018
1 parent bfddd07 commit 79794e5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
.create(this.tag)
);
release.name(this.name);
if (Objects.nonNull(this.description) && this.description.length() > 0) {
if (Objects.nonNull(this.description)) {
release.body(this.description);
}
} catch (IOException | IllegalArgumentException e) {
Expand Down
22 changes: 22 additions & 0 deletions src/test/java/org/llorllale/mvn/plgn/releasecat/UploadTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,26 @@ public void releaseHasGivenDescription() throws Exception {
is("Description")
);
}

/**
* Release should be created with the given description.
*
* @throws Exception unexpected
* @since 0.2.0
* @todo #3:30min jcabi-github should not be prepopulating optional attributes of fake
* releases with default values like this. That's why this test is checking for
* 'Description of the release'. I've opened https://github.com/jcabi/jcabi-github/issues/1362
* for this issue. When that is fixed, come back here and refactor this test.
*
*/
@Test
public void descriptionIsNullIfNotSpecified() throws Exception {
final Repo repo = new MkGithub().repos()
.create(new Repos.RepoCreate("my_user/my_project", false));
new Upload("Tag v1.0", "Name v1.0", null, () -> repo).execute();
assertThat(
new Release.Smart(new Releases.Smart(repo.releases()).find("Tag v1.0")).body(),
is("Description of the release")
);
}
}

0 comments on commit 79794e5

Please sign in to comment.