Behavior.swift 887 B

12345678910111213141516171819
  1. /// A `Behavior` encapsulates a set of examples that can be re-used in several locations using the `itBehavesLike`
  2. /// function with a context instance of the generic type.
  3. open class Behavior<Context> {
  4. /**
  5. Override this variable if you want to provide custom name for this example group.
  6. */
  7. open class var name: String { return String(describing: self) }
  8. /**
  9. Override this method in your behavior to define a set of reusable examples.
  10. This behaves just like an example group defines using `describe` or `context`--it may contain any number of `beforeEach`
  11. and `afterEach` closures, as well as any number of examples (defined using `it`).
  12. - parameter aContext: A closure that, when evaluated, returns a `Context` instance that provide the information on the subject.
  13. */
  14. open class func spec(_ aContext: @escaping () -> Context) {}
  15. }