Created
June 14, 2012 15:35
-
-
Save grimrose/2931019 to your computer and use it in GitHub Desktop.
Spock GroovyScript Spec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
println "Hello groovy!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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