Skip to content

Instantly share code, notes, and snippets.

@grimrose
Created June 14, 2012 15:35
Show Gist options
  • Save grimrose/2931019 to your computer and use it in GitHub Desktop.
Save grimrose/2931019 to your computer and use it in GitHub Desktop.
Spock GroovyScript Spec
println "Hello groovy!"
import spock.lang.Specification
import spock.lang.Unroll
class SampleSpec extends Specification {
@Unroll
def "#scriptfile evaluate"() {
setup:
def content = new StringWriter()
Binding binding = new Binding()
binding.out = new PrintWriter(content)
GroovyShell shell = new GroovyShell(binding)
when:
shell.evaluate(new File(scriptfile))
then:
content.toString().trim() == result
where:
scriptfile | result
"hello.groovy" | "Hello groovy!"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment