Skip to content

Instantly share code, notes, and snippets.

@beyondxscratch
Created August 1, 2019 18:52
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save beyondxscratch/3688b7dbcaf927a51653148890e61739 to your computer and use it in GitHub Desktop.
import org.craftsrecords.talkadvisor.recommendation.api.CreateProfile
import org.craftsrecords.talkadvisor.recommendation.spi.Profiles
class ProfileStepdefs(private val testContext: TestContext,
private val createProfile: CreateProfile,
private val profiles: Profiles) {
@Given("^he already has a profile$")
fun `he already has a profile`() {
val profile = Profile(testContext.userId, createPreferences())
profiles.save(profile)
}
@When("^he creates his profile$")
fun `he creates his profile`() {
val preferences = preferencesFromContext()
val profile = createProfile.forUserWithPreferences(testContext.userId, preferences)
testContext.requestedPreferences = preferences
testContext.createdProfile = profile
}
@Then("^his preferences are stored within$")
fun `his preferences are stored within`() {
val profile = testContext.createdProfile
val frequentUser = testContext.userId
val hisPreferences = testContext.requestedPreferences
profile.that `corresponds to user` frequentUser
profile.that `has preferences` hisPreferences
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment