summaryrefslogtreecommitdiff
path: root/spec/javascripts/api_spec.js
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-06-27 10:43:26 +0100
committerPhil Hughes <me@iamphill.com>2018-06-27 10:44:54 +0100
commit5c483fd8656805b39b451fcd25c1efbd112d3cae (patch)
tree9d9d7c331030373d9454674f2b57c1f81faa2e54 /spec/javascripts/api_spec.js
parent093e43a01157854f0ef1ce435e7935feba041e27 (diff)
downloadgitlab-ce-5c483fd8656805b39b451fcd25c1efbd112d3cae.tar.gz
specs
Diffstat (limited to 'spec/javascripts/api_spec.js')
-rw-r--r--spec/javascripts/api_spec.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/javascripts/api_spec.js b/spec/javascripts/api_spec.js
index e8435116221..c53b6da4b48 100644
--- a/spec/javascripts/api_spec.js
+++ b/spec/javascripts/api_spec.js
@@ -362,4 +362,29 @@ describe('Api', () => {
.catch(done.fail);
});
});
+
+ describe('createBranch', () => {
+ it('creates new branch', done => {
+ const ref = 'master';
+ const branch = 'new-branch-name';
+ const dummyProjectPath = 'gitlab-org/gitlab-ce';
+ const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/${encodeURIComponent(
+ dummyProjectPath,
+ )}/repository/branches`;
+
+ spyOn(axios, 'post').and.callThrough();
+
+ mock.onPost(expectedUrl).replyOnce(200, {
+ name: branch,
+ });
+
+ Api.createBranch(dummyProjectPath, { ref, branch })
+ .then(({ data }) => {
+ expect(data.name).toBe(branch);
+ expect(axios.post).toHaveBeenCalledWith(expectedUrl, { ref, branch });
+ })
+ .then(done)
+ .catch(done.fail);
+ });
+ });
});