1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00

Merge pull request #280 from marcusholl/pr/libResourceAndReadYamlCloserToReality

Be more precise with libraryResource and read yaml in prepareDefaultV…
This commit is contained in:
Marcus Holl 2018-09-21 13:37:10 +02:00 committed by GitHub
commit 1802d0c15a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,16 +30,14 @@ public class PrepareDefaultValuesTest extends BasePiperTest {
@Before
public void setup() {
helper.registerAllowedMethod("libraryResource", [String], { fileName-> return fileName })
helper.registerAllowedMethod("readYaml", [Map], { m ->
switch(m.text) {
case 'default_pipeline_environment.yml': return [default: 'config']
case 'custom.yml': return [custom: 'myConfig']
helper.registerAllowedMethod("libraryResource", [String], { fileName ->
switch(fileName) {
case 'default_pipeline_environment.yml': return "default: 'config'"
case 'custom.yml': return "custom: 'myConfig'"
case 'not_found': throw new hudson.AbortException('No such library resource not_found could be found')
default: return [the:'end']
default: return "the:'end'"
}
})
}
@Test