diff --git a/Sources/Rorschach/Builders/TestBuilder.swift b/Sources/Rorschach/Builders/TestBuilder.swift index 3cb1700..a8d724e 100644 --- a/Sources/Rorschach/Builders/TestBuilder.swift +++ b/Sources/Rorschach/Builders/TestBuilder.swift @@ -9,11 +9,11 @@ import Foundation @_functionBuilder public struct TestBuilder { - static public func buildBlock(_ given: Given, _ when: When, _ then: Then) -> (Given, When, Then) { + public static func buildBlock(_ given: Given, _ when: When, _ then: Then) -> (Given, When, Then) { return (given, when, then) } - static public func buildBlock(_ when: When, _ then: Then) -> (When, Then) { + public static func buildBlock(_ when: When, _ then: Then) -> (When, Then) { return (when, then) } } diff --git a/Sources/Rorschach/Builders/ThenBuilder.swift b/Sources/Rorschach/Builders/ThenBuilder.swift index 98dca69..e2ddc15 100644 --- a/Sources/Rorschach/Builders/ThenBuilder.swift +++ b/Sources/Rorschach/Builders/ThenBuilder.swift @@ -8,9 +8,8 @@ import Foundation -@_functionBuilder struct ThenBuilder { - - static func buildBlock(_ assertion: Assertion) -> Assertion { +@_functionBuilder public struct ThenBuilder { + public static func buildBlock(_ assertion: Assertion) -> Assertion { assertion } } diff --git a/Sources/Rorschach/When.swift b/Sources/Rorschach/When.swift index f6b0c05..78eab54 100644 --- a/Sources/Rorschach/When.swift +++ b/Sources/Rorschach/When.swift @@ -10,15 +10,17 @@ import XCTest public struct When { - let step: Step + let steps: [Step] - public init(@WhenBuilder _ content: () -> Step) { - step = content() + public init(@WhenBuilder _ content: () -> [Step]) { + steps = content() } func execute(in context: inout C) { - XCTContext.runActivity(named: step.title) { activity in - step.execute(in: &context) + steps.forEach { step in + XCTContext.runActivity(named: step.title ) { _ in + step.execute(in: &context) + } } } }