Skip to content

Commit

Permalink
spock 0.6-ify the @unroll annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
telly authored and telly committed Jun 3, 2011
1 parent 47983e7 commit dd86349
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
15 changes: 9 additions & 6 deletions test/functional/scaffolding/InputTypesForRelationsSpec.groovy
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package scaffolding

import grails.util.*
import spock.lang.*
import scaffolding.example.*
import scaffolding.example.Author
import scaffolding.example.Book
import scaffolding.example.Cover
import scaffolding.example.Genre
import spock.lang.Shared
import spock.lang.Unroll

class InputTypesForRelationsSpec extends NoJavascriptSpec {

Expand All @@ -29,7 +32,7 @@ class InputTypesForRelationsSpec extends NoJavascriptSpec {
go "/thing/create"
}

@Unroll("the #input field on #url is a selected type with the options #options")
@Unroll({"the $input field on $url is a selected type with the options $options"})
def "appropriate input types are used"() {
given:
go url
Expand All @@ -52,7 +55,7 @@ class InputTypesForRelationsSpec extends NoJavascriptSpec {
expect: $("#formats").empty
}

@Unroll("the #input input on #url has the #attribute attribute")
@Unroll({"the $input input on $url has the $attribute attribute"})
def "inputs have correct boolean attributes"() {
given:
go url
Expand All @@ -68,7 +71,7 @@ class InputTypesForRelationsSpec extends NoJavascriptSpec {
"/format/create?book.id=$book.id" | "#book" | "required"
}

@Unroll("the #input input on #url does not have the #attribute attribute")
@Unroll({"the $input input on $url does not have the $attribute attribute"})
def "inputs do not have inappropriate boolean attributes"() {
given:
go url
Expand Down
16 changes: 8 additions & 8 deletions test/functional/scaffolding/InputTypesSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class InputTypesSpec extends NoJavascriptSpec {
go "/thing/create"
}

@Unroll("the #input input is type #expectedType")
@Unroll({"the $input input is type $expectedType"})
def "appropriate input types are used"() {
expect:
$(input).is("input")
Expand All @@ -26,7 +26,7 @@ class InputTypesSpec extends NoJavascriptSpec {
"#aBoolean" | "checkbox"
}

@Unroll("the #input input is a #expectedType")
@Unroll({"the $input input is a $expectedType"})
def "appropriate input tags are used"() {
expect:
$(input).is(expectedType)
Expand All @@ -37,7 +37,7 @@ class InputTypesSpec extends NoJavascriptSpec {
"#optionalLongText" | "textarea"
}

@Unroll("#input is a select with the options #options")
@Unroll({"$input is a select with the options $options"})
def "select inputs have the correct options"() {
expect:
$(input).is("select")
Expand All @@ -53,7 +53,7 @@ class InputTypesSpec extends NoJavascriptSpec {
"#optionalEnum" | [""] + Environment.values()*.toString()
}

@Unroll("the #input input has #attribute='#value'")
@Unroll({"the $input input has $attribute='$value'"})
def "inputs have correct attributes"() {
expect:
$(input).@"$attribute" == value
Expand All @@ -69,7 +69,7 @@ class InputTypesSpec extends NoJavascriptSpec {
"#numberWithMinAndMax" | "max" | "100"
}

@Unroll("the #input input has the #attribute attribute")
@Unroll({"the $input input has the $attribute attribute"})
def "inputs have correct boolean attributes"() {
expect:
!($(input).getElement(0).getAttribute(attribute) in [null, false, "false"]) // drivers handle boolean attributes differently
Expand All @@ -88,7 +88,7 @@ class InputTypesSpec extends NoJavascriptSpec {
"#anEnum" | "required"
}

@Unroll("the #input input does not have the #attribute attribute")
@Unroll({"the $input input does not have the $attribute attribute"})
def "inputs do not have inappropriate boolean attributes"() {
expect:
$(input).getElement(0).getAttribute(attribute) in [null, false, "false"] // drivers handle boolean attributes differently
Expand All @@ -108,10 +108,10 @@ class InputTypesSpec extends NoJavascriptSpec {
}

@Issue("http://jira.grails.org/browse/GRAILS-5258")
@Unroll("the #input is present on the page")
@Unroll({"the $input input is present on the page"})
def "inputs for embedded properties are rendered"() {
expect:
$("input[name=$input]").is("input")
$("input[name='$input']").is("input")

where:
input << ["address.street", "address.city", "address.postCode"]
Expand Down
2 changes: 1 addition & 1 deletion test/functional/scaffolding/InputValuesSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class InputValuesSpec extends NoJavascriptSpec {
go "/thing/edit/$thingInstance.id"
}

@Unroll("the value of the #input input should be '#value'")
@Unroll({"the value of the $input input should be '$value'"})
def "text input values"() {
expect:
$(input).value() == value as String
Expand Down

0 comments on commit dd86349

Please sign in to comment.