Skip to content

Instantly share code, notes, and snippets.

@Zuchos
Last active October 30, 2018 07:23
Show Gist options
  • Save Zuchos/82943afaac3f0783a22acaa28091295d to your computer and use it in GitHub Desktop.
Save Zuchos/82943afaac3f0783a22acaa28091295d to your computer and use it in GitHub Desktop.
trait AcceptanceSpec
extends FlatSpecLike
with BeforeAndAfterEach
with Matchers
with LazyLogging
with AbstractPatienceConfiguration
abstract class StoreAcceptanceSpec
extends TestKit(ActorSystem("StoreAcceptanceSpec"))
with AcceptanceSpec
import EcommerceDomainGenerators.generateRandomOrder
import StoreSupport._
import ScalaFutures._
class BuyItemSpec extends AcceptanceSpec {
val mockUserDao = new MockUserDao()
val storeModule = new StoreModule() {
override def userDao = mockUserDao
}
override protected def beforeEach(): Unit = {
super.beforeEach()
mockUserDao.clear()
}
it should "buy something..." in {
// Given
val order = generateRandomOrder(UserHelpers.randomCustomer())
// When
val result = storeModule.orderService.placeOrder(order).futureValue
// Then
result should be(Right(OrderPlaced(order.id)))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment