                     messageLabel.text = "1-800-555-1234"
                     messageLabel.enabledDetectors = [.phoneNumber]
                     let attributes = messageLabel.textAttributes
-                    let textFont = attributes?[.font] as? UIFont
-                    expect(textFont).toNot(beNil())
+                    let textFont = attributes[.font] as? UIFont
                     expect(textFont).to(equal(expectedFont))
                 }
             }

                    messageLabel.text = "https://github.com/MessageKit"
                    messageLabel.enabledDetectors = [.url]
                    let attributes = messageLabel.textAttributes
                    let textColor = attributes?[.foregroundColor] as? UIColor
                    expect(textColor).toNot(beNil())
                    expect(textColor).to(equal(expectedColor))
                }
            }


fileprivate extension MessageLabel {

    var textAttributes: [NSAttributedStringKey: Any] {
        let length = attributedText!.length
        var range = NSRange(location: 0, length: length)
        return attributedText!.attributes(at: 0, effectiveRange: &range)
    }
}
