//Spec2
import org.specs2.mutable._
//Play
import play.api.test._
import play.api.test.Helpers._
import play.api.libs.ws._
class MessageSpec extends Specification {
val specs: Traversable[Seq[String]] = csv(resource("replication.csv")) //using fireotter to parse the data from a csv file
"The Message Request" should {
//iterate over each spec
specs foreach { spec =>
val test = spec(0).toString
val name = spec(1).toString
val message = spec(2).toString
val date = spec(3).toString
test in new WithServer(app = fakeApp) {
//build and send the request to the messages endpoint
//message will be received by controller and passed on to actor system to be analyzed.
"name" -> Seq(name),
"message" -> Seq(message),
"date" -> Seq(date))))
Thread.sleep(100) //waiting for actors to complete analysis of the request
//Open app.DB Connection and compare actual results to expected results. ie, actual must equalTo(expected)
}
}
}
}