diff --git a/Sources/Nimble/Matchers/Contain.swift b/Sources/Nimble/Matchers/Contain.swift index d92a80cfc..2c84c5c72 100644 --- a/Sources/Nimble/Matchers/Contain.swift +++ b/Sources/Nimble/Matchers/Contain.swift @@ -61,7 +61,7 @@ public func contain(_ items: [Any?]) -> Predicate { return Predicate.simple("contain <\(arrayAsString(items))>") { actualExpression in guard let actual = try actualExpression.evaluate() else { return .fail } let matches = items.all { item in - return item != nil && actual.contains(item!) + return item.map { actual.contains($0) } ?? false } return PredicateStatus(bool: matches) }