Skip to content

Instantly share code, notes, and snippets.

@NTCoding
Created January 23, 2016 15:50
Show Gist options
  • Select an option

  • Save NTCoding/9a46fca7348da8a186c3 to your computer and use it in GitHub Desktop.

Select an option

Save NTCoding/9a46fca7348da8a186c3 to your computer and use it in GitHub Desktop.
class TestWithoutMocks extends FreeSpec with Matchers with FutureAwaits with DefaultAwaitTimeout {
val userId = "12345"
val user = User(userId)
val friend = User("friendId")
val friendsDetails = NewAccountDetails("abc@mailinator.com", "abb", 1)
val results = Seq(PromoteToGoldStatus(userId))
"When an existing user" - {
"recommends a friend using details that validate" - {
"the friend is created and the referral policy's decision is returned" in {
val f = RecommendAFriend(
ret(friendsDetails)(None), retF(userId)(Some(user)), retF(friendsDetails)(friend), ret(user, friend)(results)
) _
assert(await(f(userId, friendsDetails)) === Right(results))
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment