package com.mi.infra.spec.async
import org.scalatest.{FutureOutcome, Matchers, AsyncFunSpec}
import scala.concurrent.Future
class AsyncSetupTest extends AsyncFunSpec with Matchers {
override def withFixture(test: NoArgAsyncTest): FutureOutcome = {
val futureTestResult = Future {
// In the real world this would be an asynchronous operation,
// e.g., dropping a database using a reactive API
println("Dropping a table")
} flatMap { result =>
super.withFixture(test).toFuture
}
new FutureOutcome(futureTestResult)
}
describe("Just a test test") {
it ("should succeed in the future") {
Future {
// In the real world this would be an asynchronous operation,
// e.g., querying a database using a reactive API
println("Query DB")
} map { _ =>
true shouldBe true
}
}
}
}
--
You received this message because you are subscribed to the Google
Groups "scalatest-users" group.
To post to this group, send email to scalatest-users@googlegroups.com
To unsubscribe from this group, send email to
scalatest-users+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/scalatest-users?hl=en
ScalaTest itself, and documentation, is available here:
http://www.artima.com/scalatest
---
You received this message because you are subscribed to a topic in the Google Groups "scalatest-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scalatest-users/G8PTv8n9tHM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to scalatest-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Confidential - Do not duplicate or distribute without written permission from Milan Innovincy B.V
© Milan Innovincy B.V, 2015. Any third party right are hereby acknowledged. All rights reserved.
You received this message because you are subscribed to the Google Groups "scalatest-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalatest-users+unsubscribe@googlegroups.com.