summaryrefslogtreecommitdiff
path: root/spec/lib/bitbucket_server
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-07-31 21:14:36 -0700
committerStan Hu <stanhu@gmail.com>2018-07-31 21:14:36 -0700
commitd2fd6d23513b18b2fd6fe93fe76e5ea4c97120b3 (patch)
treeef35db5cc12ac84a3446770ea2376492c1eca7a5 /spec/lib/bitbucket_server
parent7704404335814b39922d32eacf6b6f0961b9820f (diff)
downloadgitlab-ce-d2fd6d23513b18b2fd6fe93fe76e5ea4c97120b3.tar.gz
Deal with subpaths and trailing slashes properly
Diffstat (limited to 'spec/lib/bitbucket_server')
-rw-r--r--spec/lib/bitbucket_server/client_spec.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/spec/lib/bitbucket_server/client_spec.rb b/spec/lib/bitbucket_server/client_spec.rb
index d7931d6e4b5..f926ae963a4 100644
--- a/spec/lib/bitbucket_server/client_spec.rb
+++ b/spec/lib/bitbucket_server/client_spec.rb
@@ -1,7 +1,8 @@
require 'spec_helper'
describe BitbucketServer::Client do
- let(:options) { { base_uri: 'https://test:7990', user: 'bitbucket', password: 'mypassword' } }
+ let(:base_uri) { 'https://test:7990/stash/' }
+ let(:options) { { base_uri: base_uri, user: 'bitbucket', password: 'mypassword' } }
let(:project) { 'SOME-PROJECT' }
let(:repo_slug) { 'my-repo' }
let(:headers) { { "Content-Type" => "application/json" } }
@@ -36,7 +37,7 @@ describe BitbucketServer::Client do
describe '#repo' do
let(:path) { "/projects/#{project}/repos/#{repo_slug}" }
- let(:url) { "https://test:7990/rest/api/1.0/projects/SOME-PROJECT/repos/my-repo" }
+ let(:url) { "#{base_uri}rest/api/1.0/projects/SOME-PROJECT/repos/my-repo" }
it 'requests a specific repository' do
stub_request(:get, url).to_return(status: 200, headers: headers, body: '{}')
@@ -60,7 +61,7 @@ describe BitbucketServer::Client do
describe '#create_branch' do
let(:branch) { 'test-branch' }
let(:sha) { '12345678' }
- let(:url) { 'https://test:7990/rest/api/1.0/projects/SOME-PROJECT/repos/my-repo/branches' }
+ let(:url) { "#{base_uri}rest/api/1.0/projects/SOME-PROJECT/repos/my-repo/branches" }
it 'requests Bitbucket to create a branch' do
stub_request(:post, url).to_return(status: 204, headers: headers, body: '{}')
@@ -74,7 +75,7 @@ describe BitbucketServer::Client do
describe '#delete_branch' do
let(:branch) { 'test-branch' }
let(:sha) { '12345678' }
- let(:url) { 'https://test:7990/rest/branch-utils/1.0/projects/SOME-PROJECT/repos/my-repo/branches' }
+ let(:url) { "#{base_uri}rest/branch-utils/1.0/projects/SOME-PROJECT/repos/my-repo/branches" }
it 'requests Bitbucket to create a branch' do
stub_request(:delete, url).to_return(status: 204, headers: headers, body: '{}')