forked from paulirish/git-open
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgitlab.bats
More file actions
52 lines (43 loc) · 1.64 KB
/
gitlab.bats
File metadata and controls
52 lines (43 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env bats
load "test_helper/index"
##
## GitLab
##
@test "gitlab: default ssh origin style" {
# https://github.com/paulirish/git-open/pull/55
git remote set-url origin "[email protected]:user/repo"
run ../git-open
assert_output "https://gitlab.example.com/user/repo"
}
@test "gitlab: ssh://git@ origin" {
# https://github.com/paulirish/git-open/pull/51
git remote set-url origin "ssh://[email protected]/user/repo"
run ../git-open
assert_output "https://gitlab.domain.com/user/repo"
refute_output --partial "//user"
}
@test "gitlab: separate domains" {
# https://github.com/paulirish/git-open/pull/56
git remote set-url origin "[email protected]:namespace/project.git"
git config --local --add "open.https://git.example.com.domain" "gitlab.example.com"
run ../git-open
assert_output "https://gitlab.example.com/namespace/project"
}
@test "gitlab: special domain and path" {
git remote set-url origin "ssh://[email protected]:7000/XXX/YYY.git"
git config --local --add "open.https://git.example.com.domain" "repo.intranet/subpath"
git config --local --add "open.https://git.example.com.protocol" "http"
run ../git-open
assert_output "http://repo.intranet/subpath/XXX/YYY"
refute_output --partial "https://"
}
@test "gitlab: different port" {
# https://github.com/paulirish/git-open/pull/76
git remote set-url origin "ssh://[email protected]:7000/XXX/YYY.git"
run ../git-open
assert_output "https://git.example.com/XXX/YYY"
refute_output --partial ":7000"
git remote set-url origin "https://git.example.com:7000/XXX/YYY.git"
run ../git-open
assert_output "https://git.example.com:7000/XXX/YYY"
}