Skip to content

Instantly share code, notes, and snippets.

@arttuladhar
arttuladhar / GebDemoSpec.groovy
Created June 12, 2017 22:06
REST API Testing Using Spock
package specs
import geb.spock.GebReportingSpec
class GebDemoSpec extends GebReportingSpec {
def "Testing Basic Page Contents"(){
setup:
go "http://localhost:9000/#/demo/geb-demo"
@jiffle
jiffle / Spock Cheatsheet.md
Last active May 9, 2024 14:19
Spock Useful Patterns Cheatsheet

Spock Useful Patterns Cheatsheet

Adding sequences of behaviour to Mocks and Stubs

The >>> operator allows a sequence of values to be returned:

myMock.someCall() >>> ['first value', 'second value', 'third value', 'etc']

This returns each string in turn. Behaviour (such as throwing exceptions) in closures cannot be used by this operator.

The >> operator allows value or behaviour (closures) to be returned