@@ -11,54 +11,65 @@ Class {
1111{ #category : ' tests' }
1212GitlabBranchesTest >> testCreateInProjectFromRef [
1313
14- | hostUrl gitlabApi branchName projectId ref result client postMessage |
15-
14+ | hostUrl gitlabApi branchName projectId ref result client postMessage |
1615 " Given"
1716 hostUrl := ' www.url.com' .
1817 client := ZnClient new .
1918 postMessage := ' success' .
20-
21- client stub post willReturn: ' {"message": "' , postMessage, ' "}' .
22- gitlabApi := GitlabApi new privateToken: ' token' ; hostUrl: hostUrl; client: client.
23-
19+
20+ client stub post willReturn: ' {"message": "' , postMessage , ' "}' .
21+ gitlabApi := GitlabApi new
22+ privateToken: ' token' ;
23+ hostUrl: hostUrl;
24+ client: client.
25+
2426 branchName := ' test' .
2527 projectId := 1 .
2628 ref := ' main' .
27-
29+
2830 " When"
29- result := gitlabApi branches create: branchName inProject: projectId fromRef: ref.
30-
31+ result := gitlabApi branches
32+ create: branchName
33+ inProject: projectId
34+ fromRef: ref.
35+
3136 " Then"
3237 (client request url query at: #branch ) should be: branchName.
3338 (client request url query at: #ref ) should be: ref.
3439 self assert: (result at: #message ) equals: postMessage
35-
3640]
3741
3842{ #category : ' tests' }
3943GitlabBranchesTest >> testGetAllFromProject [
4044
4145 | hostUrl gitlabApi projectId result client branch1 branch2 gitlabBranches endpoint |
42-
4346 " Given"
4447 hostUrl := ' www.url.com' .
4548 client := Mock new .
46-
47- gitlabApi := GitlabApi new privateToken: ' token' ; hostUrl: hostUrl; client: client; output: ' json' .
48-
49+
50+ gitlabApi := GitlabApi new
51+ privateToken: ' token' ;
52+ hostUrl: hostUrl;
53+ client: client;
54+ output: ' json' .
55+
4956 gitlabBranches := GitlabBranches new gitlabAPI: gitlabApi.
50-
57+
5158 branch1 := ' {"name": "branch1"}' .
5259 branch2 := ' {"name": "branch2"}' .
5360 projectId := 1 .
54-
55- endpoint := ' /projects/' , projectId asString, ' /repository/branches' .
56- (gitlabBranches stub getAll: endpoint withParams: Dictionary new ) willReturn: { branch1. branch2 }.
57-
61+
62+ endpoint := ' /projects/' , projectId asString
63+ , ' /repository/branches' .
64+ (gitlabBranches stub getAll: endpoint withParams: Dictionary new )
65+ willReturn: {
66+ branch1.
67+ branch2 }.
68+
5869 " When"
5970 result := gitlabBranches getAllFromProject: projectId.
60-
71+
6172 " Then"
6273 self assert: result size equals: 2 .
63- self assert: ( result first) equals: branch1.
74+ self assert: result first equals: branch1
6475]
0 commit comments