Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-05-10 00:17:05 +0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-05-14 01:55:42 +0300
commite001bd5e3d813fa72f724fc0e661b36099f678ea (patch)
treec0fb3c1e97ebc2303e3c2c098c1e81c8f7b45a03 /spec/lib
parent7e1f14e21517d3907a0e096d44b30797612f69cd (diff)
Import PRs where branch names were reused across PRs
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/github_import/pull_request_formatter_spec.rb32
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