Skip to content

Instantly share code, notes, and snippets.

@werne2j
Created October 11, 2019 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save werne2j/160ca17341b0f26f302b85690ed08f0e to your computer and use it in GitHub Desktop.
Save werne2j/160ca17341b0f26f302b85690ed08f0e to your computer and use it in GitHub Desktop.
import com.homeaway.devtools.jenkins.testing.JenkinsPipelineSpecification
class BuildJavascriptAppSpec extends JenkinsPipelineSpecification {
def buildJavascriptApp = null
def setup() {
buildJavascriptApp = loadPipelineScriptForTest("vars/buildJavascriptApp.groovy")
}
def "[buildJavascriptApp] will run npm publish if deploy is true"() {
when:
buildJavascriptApp deploy: true
then:
1 * getPipelineMock("sh")("npm publish")
}
def "[buildJavascriptApp] will not npm publish if deploy is false"() {
when:
buildJavascriptApp deploy: false
then:
0 * getPipelineMock("sh")("npm publish")
}
def "[buildJavascriptApp] will call closure if passed"() {
setup:
def body = Mock(Closure)
when:
buildJavascriptApp deploy: false, body
then:
1 * body()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment