@@ -21,6 +21,8 @@ import grails.buildtestdata.mixin.Build
21
21
import grails.test.mixin.Mock
22
22
import grails.test.mixin.TestFor
23
23
import spock.lang.Specification
24
+ import spock.lang.Unroll
25
+
24
26
/**
25
27
* Test-suite for {@link Location}
26
28
*/
@@ -29,15 +31,23 @@ import spock.lang.Specification
29
31
@Mock ([Location , WebPageTestServer ,Browser ])
30
32
class LocationSpec extends Specification {
31
33
32
- void " only labels up to 150 characters are valid" () {
33
- given : " a location with a valid label with 150 characters"
34
- Location location = Location . build(label : " *" . padLeft(150 ," *" ))
34
+ @Unroll
35
+ void " A location with a label of a length of #labelLength characters validates to #valid" () {
36
+
37
+ when : " a location with a label of a length of #labelLength characters is created"
38
+ Location location = Location . buildWithoutSave(label : " *" . padLeft(labelLength," *" ))
35
39
36
- when : " the label is updated to a length og 151"
37
- location. label = " *" . padLeft(151 ," *" )
40
+ then : " the location validates to #valid"
41
+ location. validate() == valid
42
+
43
+ where :
44
+ labelLength | valid
45
+ 100 | true
46
+ 200 | true
47
+ 255 | true
48
+ 256 | false
49
+ 1000 | false
38
50
39
- then : " the location doesn't validate anymore"
40
- location. validate() == false
41
51
}
42
52
43
53
void " toString includes location, WPT server and browser name, but not the location label" () {
0 commit comments