I have a simple specs2 Given When Then test case from (A simple Scala Given/When/Then style specification failed). The code cant compile. I dont know why is that. The code:
class Specs2Spec extends Specification { def is =
"addition" ^
"given first number: ${1}" ^ number1 ^
"when add another number: ${2}" ^ number2 ^
"Then the result is: ${3}" ^ result ^
end
lazy val number1: Given[Int] = (_: String).toInt
lazy val number2: When[Int, (Int, Int)] = (n1: Int) => (s: String) => (n1, s.toInt)
lazy val result: Then[(Int, Int)] = (n: (Int, Int)) => (s: String) => (n._1 + n._2) must_== s.toInt
}
The error: Error:(8, 39) overloaded method value ^ with alternatives: (a: org.specs2.main.Arguments)org.specs2.specification.Fragments ........
Many thanks in advance.
I believe the syntax has changed and you must mix in the GWT trait.
Have a look at the documentation.