summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortiagonbotelho <tiagonbotelho@hotmail.com>2016-09-27 16:39:29 +0100
committertiagonbotelho <tiagonbotelho@hotmail.com>2016-10-09 23:20:45 +0100
commitff076d88df70a70f6534faefefdca92b059318bf (patch)
tree5aa28ca73bc06719b7ef3235ec8d03a621fa5a7e
parent2de8fc3e13b64dfc50e872486aad0c33b35df8a6 (diff)
downloadgitlab-ce-ff076d88df70a70f6534faefefdca92b059318bf.tar.gz
writes tests to verify the issue is solved and fixes breaking issues.
-rw-r--r--spec/models/repository_spec.rb16
-rw-r--r--spec/support/test_env.rb4
2 files changed, 14 insertions, 6 deletions
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index 98c64c079b9..6dd3f91be17 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -115,10 +115,16 @@ describe Repository, models: true do
describe '#merged_to_root_ref?' do
context 'merged branch' do
- subject { repository.merged_to_root_ref?('improve/awesome') }
+ subject { repository.merged_to_root_ref?('branch-merged') }
it { is_expected.to be_truthy }
end
+
+ context 'not merged branch' do
+ subject { repository.merged_to_root_ref?('not-merged-branch') }
+
+ it { is_expected.to be_falsey }
+ end
end
describe '#can_be_merged?' do
@@ -316,7 +322,7 @@ describe Repository, models: true do
subject { results.first }
it { is_expected.to be_an String }
- it { expect(subject.lines[2]).to eq("master:CHANGELOG:188: - Feature: Replace teams with group membership\n") }
+ it { expect(subject.lines[2]).to eq("master:CHANGELOG:190: - Feature: Replace teams with group membership\n") }
end
end
@@ -960,10 +966,10 @@ describe Repository, models: true do
context 'cherry-picking a merge commit' do
it 'cherry-picks the changes' do
- expect(repository.blob_at_branch('master', 'foo/bar/.gitkeep')).to be_nil
+ expect(repository.blob_at_branch('improve/awesome', 'foo/bar/.gitkeep')).to be_nil
- repository.cherry_pick(user, pickable_merge, 'master')
- expect(repository.blob_at_branch('master', 'foo/bar/.gitkeep')).not_to be_nil
+ repository.cherry_pick(user, pickable_merge, 'improve/awesome')
+ expect(repository.blob_at_branch('improve/awesome', 'foo/bar/.gitkeep')).not_to be_nil
end
end
end
diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb
index 0097dbf8fad..d56274d0979 100644
--- a/spec/support/test_env.rb
+++ b/spec/support/test_env.rb
@@ -5,6 +5,8 @@ module TestEnv
# When developing the seed repository, comment out the branch you will modify.
BRANCH_SHA = {
+ 'not-merged-branch' => 'b83d6e3',
+ 'branch-merged' => '498214d',
'empty-branch' => '7efb185',
'ends-with.json' => '98b0d8b',
'flatten-dir' => 'e56497b',
@@ -14,7 +16,7 @@ module TestEnv
'improve/awesome' => '5937ac0',
'markdown' => '0ed8c6c',
'lfs' => 'be93687',
- 'master' => '5937ac0',
+ 'master' => 'b83d6e3',
"'test'" => 'e56497b',
'orphaned-branch' => '45127a9',
'binary-encoding' => '7b1cf43',