Merge branch 'master' into feature/webhook-scope

This commit is contained in:
nazoking
2015-11-06 14:48:03 +09:00
36 changed files with 524 additions and 221 deletions

View File

@@ -45,7 +45,7 @@ class JsonFormatSpec extends Specification {
forks = 0,
`private` = false,
default_branch = "master",
owner = apiUser)
owner = apiUser)(urlIsHtmlUrl = false)
val repositoryJson = s"""{
"name" : "Hello-World",
"full_name" : "octocat/Hello-World",
@@ -85,7 +85,7 @@ class JsonFormatSpec extends Specification {
"url": "http://gitbucket.exmple.com/api/v3/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e/statuses"
}"""
val apiPushCommit = ApiPushCommit(
val apiPushCommit = ApiCommit(
id = "0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c",
message = "Update README.md",
timestamp = date1,
@@ -93,7 +93,7 @@ class JsonFormatSpec extends Specification {
removed = Nil,
modified = List("README.md"),
author = ApiPersonIdent("baxterthehacker","baxterthehacker@users.noreply.github.com",date1),
committer = ApiPersonIdent("baxterthehacker","baxterthehacker@users.noreply.github.com",date1))(RepositoryName("baxterthehacker", "public-repo"))
committer = ApiPersonIdent("baxterthehacker","baxterthehacker@users.noreply.github.com",date1))(RepositoryName("baxterthehacker", "public-repo"), true)
val apiPushCommitJson = s"""{
"id": "0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c",
// "distinct": true,

View File

@@ -0,0 +1,38 @@
package gitbucket.core.view
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 {
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>)"""
}
}
}