diff options
author | Stan Hu <stanhu@gmail.com> | 2018-07-14 01:39:24 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-07-14 01:39:24 +0300 |
commit | c793252e8b33a1b7d071aca90c9c05e54ad973b5 (patch) | |
tree | 238d0c479817abd68c23212e44d6484d27f9bb04 /spec/lib/bitbucket_server | |
parent | ec4109d413f6161b43ad4cc1a6251af30d3bcf03 (diff) |
Add support for deleting branches via the Bitbucket Server API
Diffstat (limited to 'spec/lib/bitbucket_server')
-rw-r--r-- | spec/lib/bitbucket_server/connection_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/lib/bitbucket_server/connection_spec.rb b/spec/lib/bitbucket_server/connection_spec.rb index 45affbcf4e4..65c78f14f58 100644 --- a/spec/lib/bitbucket_server/connection_spec.rb +++ b/spec/lib/bitbucket_server/connection_spec.rb @@ -35,4 +35,24 @@ describe BitbucketServer::Connection do expect { subject.post(url, payload) }.to raise_error(described_class::ConnectionError) end end + + describe '#delete' do + context 'branch API' do + let(:branch_path) { '/projects/foo/repos/bar/branches' } + let(:branch_url) { 'https://test:7990/branch-utils/1.0/projects/foo/repos/bar/branches' } + let(:path) { } + + it 'returns JSON body' do + WebMock.stub_request(:delete, branch_url).to_return(body: payload.to_json, status: 200, headers: headers) + + expect(subject.delete(:branches, branch_path, payload)).to eq(payload) + end + + it 'throws an exception if the response is not 200' do + WebMock.stub_request(:delete, branch_url).to_return(body: payload.to_json, status: 500, headers: headers) + + expect { subject.delete(:branches, branch_path, payload) }.to raise_error(described_class::ConnectionError) + end + end + end end |