M. Daugherty
class DataDriven extends Specification {
def "maximum of two numbers"() {
expect:
Math.max(a, b) == c
where:
a | b || c
3 | 5 || 5
7 | 0 || 7
0 | 0 || 0
}
}
class BreadcrumbSpec extends ComponentSpec {
def setupSpec() {
pageBuilder.content {
home("Home") {
"jcr:content" {
breadcrumb(delineator: "-")
}
products("Products") {
tools("Tools") {
"jcr:content" {
breadcrumb(rootPage: "/content/home")
}
}
}
}
}
}
def "get delineator"() {
setup:
def request = componentRequestBuilder.build {
path = "/content/home/jcr:content/breadcrumb"
}
def breadcrumb = new Breadcrumb(request)
expect:
breadcrumb.delineator == "-"
}
def "get links"() {
setup:
def request = componentRequestBuilder.build {
path = "/content/home/products/tools/jcr:content/breadcrumb"
}
def breadcrumb = new Breadcrumb(request)
def links = breadcrumb.links
expect:
links.size() == 3
links*.title == ["Home", "Products", "Tools"]
}
}