Skip to content

Commit eb50ea5

Browse files
committed
fixed unit test
1 parent 3f5f896 commit eb50ea5

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

src/test/groovy/de/iteratec/osm/measurement/environment/LocationSpec.groovy

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import grails.buildtestdata.mixin.Build
2121
import grails.test.mixin.Mock
2222
import grails.test.mixin.TestFor
2323
import spock.lang.Specification
24+
import spock.lang.Unroll
25+
2426
/**
2527
* Test-suite for {@link Location}
2628
*/
@@ -29,15 +31,23 @@ import spock.lang.Specification
2931
@Mock([Location, WebPageTestServer,Browser])
3032
class LocationSpec extends Specification {
3133

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,"*"))
3539

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
3850

39-
then: "the location doesn't validate anymore"
40-
location.validate() == false
4151
}
4252

4353
void "toString includes location, WPT server and browser name, but not the location label"() {

0 commit comments

Comments
 (0)