Combined two tests into one, and added separate test for empty list of ignored commit message substrings
@@ -4,21 +4,23 @@ import spock.lang.Specification
class IgnoredCommitTest extends Specification {
- def "should skip commits with that contains given ignored substrings"() {
+ def "should skip commits that contains given ignored substrings"() {
def ignoredCommit = new IgnoredCommit(["[ci skip]", "[custom skip]"])
def commitWithCiSkip = new GitCommit("firstCommitId", "sample@email.com", "sampleAuthor", "sample [ci skip] commit message")
def commitWithCustomSkip = new GitCommit("thirdCommitId", "sample@email.com", "sampleAuthor", "sample [custom skip] commit message")
+ def commitWithoutSkipSubstringInMessage = new GitCommit("firstCommitId", "sample@email.com", "sampleAuthor", "sample commit message")
expect:
ignoredCommit.isTrue(commitWithCiSkip)
ignoredCommit.isTrue(commitWithCustomSkip)
+ ignoredCommit.isTrue(commitWithoutSkipSubstringInMessage) == false
}
- def "should not skip commit that does not contain given ignored substrings"() {
- def ignoredCommit = new IgnoredCommit(["[ci skip]", "[custom skip]"])
- def commit = new GitCommit("firstCommitId", "sample@email.com", "sampleAuthor", "sample commit message")
+ def "should not skip commit if ignored substrings list is empty"() {
+ def ignoredCommit = new IgnoredCommit([])
+ def commitWithCiSkip = new GitCommit("firstCommitId", "sample@email.com", "sampleAuthor", "sample [ci skip] commit message")
expect:
- ignoredCommit.isTrue(commit) == false
+ ignoredCommit.isTrue(commitWithCiSkip) == false
}
}
