Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.