diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-05-09 16:17:05 -0500 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-05-13 17:55:42 -0500 |
commit | e001bd5e3d813fa72f724fc0e661b36099f678ea (patch) | |
tree | c0fb3c1e97ebc2303e3c2c098c1e81c8f7b45a03 /spec | |
parent | 7e1f14e21517d3907a0e096d44b30797612f69cd (diff) | |
download | gitlab-ce-e001bd5e3d813fa72f724fc0e661b36099f678ea.tar.gz |
Import PRs where branch names were reused across PRs
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/github_import/pull_request_formatter_spec.rb | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/spec/lib/gitlab/github_import/pull_request_formatter_spec.rb b/spec/lib/gitlab/github_import/pull_request_formatter_spec.rb index 1d15d3d937e..adedc57719e 100644 --- a/spec/lib/gitlab/github_import/pull_request_formatter_spec.rb +++ b/spec/lib/gitlab/github_import/pull_request_formatter_spec.rb @@ -164,10 +164,20 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do end describe '#source_branch' do - let(:raw_data) { double(base_data) } + context 'when source branch exists' do + let(:raw_data) { double(base_data) } - it 'returns head ref' do - expect(pull_request.source_branch).to eq 'feature' + it 'returns head ref' do + expect(pull_request.source_branch).to eq 'feature' + end + end + + context 'when source branch does not exist' do + let(:raw_data) { double(base_data.merge(head: double(ref: 'removed-branch', sha: '2e5d3239642f9161dcbbc4b70a211a68e5e45e2b'))) } + + it 'returns head ref' do + expect(pull_request.source_branch).to eq 'removed-branch-2e5d3239' + end end end @@ -198,10 +208,20 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do end describe '#target_branch' do - let(:raw_data) { double(base_data) } + context 'when target branch exists' do + let(:raw_data) { double(base_data) } - it 'returns base ref' do - expect(pull_request.target_branch).to eq 'master' + it 'returns base ref' do + expect(pull_request.target_branch).to eq 'master' + end + end + + context 'when target branch does not exist' do + let(:raw_data) { double(base_data.merge(base: double(ref: 'removed-branch', sha: '8ffb3c15a5475e59ae909384297fede4badcb4c7'))) } + + it 'returns head ref' do + expect(pull_request.target_branch).to eq 'removed-branch-8ffb3c15' + end end end |