mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-07 05:55:51 +01:00
(refs #1823) Link submodule to the online repository viewer
Supports following services: - GitBucket (need to set the base url at the system settings) - GitHub - BitBucket - GitLab.com If a repository url doesn't match above services, generate a link to the git repository as before.
This commit is contained in:
@@ -63,4 +63,24 @@ class StringUtilSpec extends FunSpec {
|
||||
assert(StringUtil.extractCloseId("(refs #123)").toSeq == Nil)
|
||||
}
|
||||
}
|
||||
|
||||
describe("getRepositoryViewerUrl") {
|
||||
val baseUrl = Some("http://localhost:8080")
|
||||
it("should convert GitBucket repository url"){
|
||||
assert(StringUtil.getRepositoryViewerUrl("http://localhost:8080/git/root/gitbucket.git", baseUrl) == "http://localhost:8080/root/gitbucket")
|
||||
assert(StringUtil.getRepositoryViewerUrl("http://root@localhost:8080/git/root/gitbucket.git", baseUrl) == "http://localhost:8080/root/gitbucket")
|
||||
}
|
||||
it("should convert GitHub repository url"){
|
||||
assert(StringUtil.getRepositoryViewerUrl("https://github.com/root/gitbucket.git", baseUrl) == "https://github.com/root/gitbucket")
|
||||
assert(StringUtil.getRepositoryViewerUrl("https://root@github.com/root/gitbucket.git", baseUrl) == "https://github.com/root/gitbucket")
|
||||
}
|
||||
it("should convert BitBucket repository url"){
|
||||
assert(StringUtil.getRepositoryViewerUrl("https://bitbucket.org/root/gitbucket.git", baseUrl) == "https://bitbucket.org/root/gitbucket")
|
||||
assert(StringUtil.getRepositoryViewerUrl("https://root@bitbucket.org/root/gitbucket.git", baseUrl) == "https://bitbucket.org/root/gitbucket")
|
||||
}
|
||||
it("should convert GitLab repository url"){
|
||||
assert(StringUtil.getRepositoryViewerUrl("https://gitlab.com/root/gitbucket.git", baseUrl) == "https://gitlab.com/root/gitbucket")
|
||||
assert(StringUtil.getRepositoryViewerUrl("https://root@gitlab.com/root/gitbucket.git", baseUrl) == "https://gitlab.com/root/gitbucket")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user