Sha256: e027ad65d7c70f9c1d5f2b90d9c0c8d0f27ead9195f30601371c27f8d85ab081
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
/** A container for closures to be executed before and after each example. */ final internal class ExampleHooks { internal var befores: [BeforeExampleWithMetadataClosure] = [] internal var afters: [AfterExampleWithMetadataClosure] = [] internal func appendBefore(closure: BeforeExampleWithMetadataClosure) { befores.append(closure) } internal func appendBefore(closure: BeforeExampleClosure) { befores.append { (exampleMetadata: ExampleMetadata) in closure() } } internal func appendAfter(closure: AfterExampleWithMetadataClosure) { afters.append(closure) } internal func appendAfter(closure: AfterExampleClosure) { afters.append { (exampleMetadata: ExampleMetadata) in closure() } } internal func executeBefores(exampleMetadata: ExampleMetadata) { for before in befores { before(exampleMetadata: exampleMetadata) } } internal func executeAfters(exampleMetadata: ExampleMetadata) { for after in afters { after(exampleMetadata: exampleMetadata) } } }
Version data entries
2 entries across 2 versions & 1 rubygems