Created
May 4, 2019 19:46
-
-
Save AlicanAkkus/8f705325448a089b3c6d29d03e0cd04a to your computer and use it in GitHub Desktop.
OrderCreateFacadeTest
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
class OrderCreateFacadeTest extends Specification { | |
def orderCommissionCalculator = Mock(OrderCommissionCalculator) | |
def orderCreateFacade = new OrderCreateFacade(orderCommissionCalculator) | |
void "should create order"() { | |
given: | |
def userId = 998 | |
def paymentMethod = "CARD" | |
def price = 100 | |
and: | |
orderCommissionCalculator.calculate("CARD", 100) >> 2.3 | |
when: | |
def order = orderCreateFacade.create(userId, paymentMethod, price) | |
then: | |
with(order) { | |
it.userId == 998 | |
it.paymentMethod == "CARD" | |
it.price == 100 | |
it.commissionAmount == 2.3 | |
it.orderCreatedDate.toLocalDate() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment