This trait can be used to standardize names for groups of examples in an acceptance specification.
class MySpecification extends Specification with Examples { def is = s2"""
first example in first group ${g1.e1}
second example in first group ${g1.e2}
first example in second group ${g2.e1}
second example in second group ${g2.e2}
"""
}
trait Examples extends Grouped with Matchers {
"first group of examples" - new g1 {
e1 := ok
e2 := ok
}
"second group of examples" - new g2 {
e1 := ok
e2 := ok
}
}
If you don't want to manage groups and examples numbers it is also possible to write the following (note the script.Specification):
class MySpecification extends script.Specification with Examples { def is = s2"""
first example in first group
second example in first group
first example in second group
second example in second group
"""
}
trait Examples extends Grouped with Matchers {
"first group of examples" - new group {
eg := ok
eg := ok
}
"second group of examples" - new group {
eg := ok
eg := ok
}
}
This trait can be used to standardize names for groups of examples in an acceptance specification.
class MySpecification extends Specification with Examples { def is = s2""" first example in first group ${g1.e1} second example in first group ${g1.e2}
first example in second group ${g2.e1} second example in second group ${g2.e2} """ }
trait Examples extends Grouped with Matchers { "first group of examples" - new g1 { e1 := ok e2 := ok } "second group of examples" - new g2 { e1 := ok e2 := ok } }
If you don't want to manage groups and examples numbers it is also possible to write the following (note the
script.Specification
):class MySpecification extends script.Specification with Examples { def is = s2""" first example in first group second example in first group
first example in second group second example in second group """ }
trait Examples extends Grouped with Matchers { "first group of examples" - new group { eg := ok eg := ok } "second group of examples" - new group { eg := ok eg := ok } }