Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
object PersonSpec : Spek({
lateinit var person: Person
beforeEachGroup {
person = Person(
name = "name",
address = "address",
age = 60,
isActive = false
)
}
describe("isPersonRetired") {
describe("when isActive is true") {
beforeEachGroup {
person = person.copy(isActive = true)
}
describe("when getAge is greater than 60") {
beforeEachGroup {
person = person.copy(age = 65)
}
it("should return true") {
assertTrue(person.isPersonRetired())
}
}
describe("when getAge is equal to 60") {
beforeEachGroup {
person = person.copy(age = 60)
}
it("should return true") {
assertTrue(person.isPersonRetired())
}
}
describe("when getAge is less than 60") {
beforeEachGroup {
person = person.copy(age = 55)
}
it("should return true") {
assertTrue(person.isPersonRetired())
}
}
}
describe("when isActive is false") {
beforeEachGroup {
person = person.copy(isActive = false)
}
describe("when getAge is greater than 60") {
beforeEachGroup {
person = person.copy(age = 65)
}
it("should return true") {
assertTrue(person.isPersonRetired())
}
}
describe("when getAge is equal to 60") {
beforeEachGroup {
person = person.copy(age = 60)
}
it("should return false") {
assertFalse(person.isPersonRetired())
}
}
describe("when getAge is less than 60") {
beforeEachGroup {
person = person.copy(age = 55)
}
it("should return false") {
assertFalse(person.isPersonRetired())
}
}
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment