diff options
author | Stan Hu <stanhu@gmail.com> | 2018-08-01 07:14:36 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-08-01 07:14:36 +0300 |
commit | d2fd6d23513b18b2fd6fe93fe76e5ea4c97120b3 (patch) | |
tree | ef35db5cc12ac84a3446770ea2376492c1eca7a5 /spec/lib/bitbucket_server | |
parent | 7704404335814b39922d32eacf6b6f0961b9820f (diff) |
Deal with subpaths and trailing slashes properly
Diffstat (limited to 'spec/lib/bitbucket_server')
-rw-r--r-- | spec/lib/bitbucket_server/client_spec.rb | 9 |
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: '{}') |