Skip to content

Commit

Permalink
Merge pull request jenkinsci#175 from nre-ableton/nre/master/improve_…
Browse files Browse the repository at this point in the history
…mocks

Improve some mock implementations, add some new no-op mocks
  • Loading branch information
stchar authored Feb 14, 2020
2 parents 85861a3 + 699f502 commit 0f935ac
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/main/groovy/com/lesfurets/jenkins/unit/BasePipelineTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,15 @@ abstract class BasePipelineTest {
helper.registerAllowedMethod('cleanWs', [], null)
helper.registerAllowedMethod('copyArtifacts', [Map.class], {true})
helper.registerAllowedMethod("cron", [String.class], null)
helper.registerAllowedMethod("dir", [String.class, Closure.class], null)
helper.registerAllowedMethod('deleteDir', [], null)
helper.registerAllowedMethod("dir", [String.class, Closure.class]) { String path, Closure body ->
c.delegate = delegate
helper.callClosure(c)
}
helper.registerAllowedMethod("disableConcurrentBuilds", [], null)
helper.registerAllowedMethod("echo", [String.class], null)
helper.registerAllowedMethod("echo", [String.class]) { String message ->
println(message)
}
helper.registerAllowedMethod("error", [String.class], { updateBuildStatus('FAILURE') })
helper.registerAllowedMethod("gatlingArchive", [], null)
helper.registerAllowedMethod("gitlabBuilds", [Map.class, Closure.class], null)
Expand All @@ -100,24 +106,31 @@ abstract class BasePipelineTest {
helper.registerAllowedMethod("input", [String.class], null)
helper.registerAllowedMethod("junit", [String.class], null)
helper.registerAllowedMethod("logRotator", [Map.class], null)
helper.registerAllowedMethod('mail', [Map.class], null)
helper.registerAllowedMethod("node", [Closure.class], null)
helper.registerAllowedMethod("node", [String.class, Closure.class], null)
helper.registerAllowedMethod("pipelineTriggers", [List.class], null)
helper.registerAllowedMethod("properties", [List.class], null)
helper.registerAllowedMethod("readFile", [String.class], null)
helper.registerAllowedMethod('retry', [Integer.class, Closure.class], null)
helper.registerAllowedMethod('retry', [Integer.class, Closure.class]) { Integer count, Closure body ->
c.delegate = delegate
helper.callClosure(c)
}
helper.registerAllowedMethod("sh", [Map.class], null)
helper.registerAllowedMethod("sh", [String.class], null)
helper.registerAllowedMethod('skipDefaultCheckout', [], null)
helper.registerAllowedMethod('sleep', [], null)
helper.registerAllowedMethod('specific', [String.class], null)
helper.registerAllowedMethod('sshPublisher', [Map.class], {true})
helper.registerAllowedMethod('stash', [Map.class], null)
helper.registerAllowedMethod("stage", [String.class], null)
helper.registerAllowedMethod("stage", [String.class, Closure.class], null)
helper.registerAllowedMethod("step", [Map.class], null)
helper.registerAllowedMethod("string", [Map.class], stringInterceptor)
helper.registerAllowedMethod('timeout', [Map.class], null)
helper.registerAllowedMethod("timeout", [Map.class, Closure.class], null)
helper.registerAllowedMethod("unstable", [String.class], { updateBuildStatus('UNSTABLE') })
helper.registerAllowedMethod('unstash', [Map.class], null)
helper.registerAllowedMethod("warnError", [String.class, Closure.class], { Closure c ->
try {
c.delegate = delegate
Expand All @@ -127,6 +140,7 @@ abstract class BasePipelineTest {
}
})
helper.registerAllowedMethod("withCredentials", [List.class, Closure.class], withCredentialsInterceptor)
helper.registerAllowedMethod('writeFile', [Map.class], null)
helper.registerAllowedMethod("ws", [String.class, Closure.class], null)
}

Expand Down

0 comments on commit 0f935ac

Please sign in to comment.