Refined regex and removed explicit TLDs

Also made regex val private.
This commit is contained in:
Tobias Roeser
2015-10-14 22:42:35 +02:00
parent 5a97a518a6
commit 00cd3adc7b
2 changed files with 8 additions and 7 deletions

View File

@@ -5,28 +5,28 @@ import org.specs2.mutable._
class HelpersSpec extends Specification {
import helpers._
"detect and render links" should {
"pass identical string when no link is present" in {
val before = "Description"
val after = detectAndRenderLinks(before).toString()
after mustEqual before
}
"convert a single link" in {
val before = "http://example.com"
val after = detectAndRenderLinks(before).toString()
after mustEqual """<a href="http://example.com">http://example.com</a>"""
}
"convert a single link within trailing text" in {
val before = "Example Project. http://example.com"
val after = detectAndRenderLinks(before).toString()
after mustEqual """Example Project. <a href="http://example.com">http://example.com</a>"""
}
"convert a mulitple links within text" in {
"convert a mulitple links within text" in {
val before = "Example Project. http://example.com. (See also https://github.com/)"
val after = detectAndRenderLinks(before).toString()
after mustEqual """Example Project. <a href="http://example.com">http://example.com</a>. (See also <a href="https://github.com/">https://github.com/</a>)"""