Skip to content

Commit 5b169f9

Browse files
authored
Merge pull request #1140 from allanlewis/patch-1
Testing-DSL-Scripts.md: Simplify `getJobFiles`
2 parents 62f484d + 7640bd4 commit 5b169f9

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

docs/Testing-DSL-Scripts.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ The content of the following code block must be saved in a file called `src/test
9090
The test specification will locate all Job DSL scripts within the `jobs` directory and create a test for each file.
9191
The test will then run each script file to check the script for problems.
9292

93+
import groovy.util.FileNameFinder
9394
import javaposse.jobdsl.dsl.DslScriptLoader
9495
import javaposse.jobdsl.plugin.JenkinsJobManagement
9596
import org.junit.ClassRule
@@ -119,13 +120,7 @@ The test will then run each script file to check the script for problems.
119120
}
120121

121122
static List<File> getJobFiles() {
122-
List<File> files = []
123-
new File('jobs').eachFileRecurse {
124-
if (it.name.endsWith('.groovy')) {
125-
files << it
126-
}
127-
}
128-
files
123+
new FileNameFinder().getFileNames('jobs', '**/*.groovy').collect { new File(it) }
129124
}
130125
}
131126

0 commit comments

Comments
 (0)