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
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