Last active
October 30, 2018 07:23
-
-
Save Zuchos/82943afaac3f0783a22acaa28091295d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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