diff options
author | Ahmad Sherif <me@ahmadsherif.com> | 2018-01-09 15:53:35 +0300 |
---|---|---|
committer | Ahmad Sherif <me@ahmadsherif.com> | 2018-01-11 18:40:13 +0300 |
commit | b4b267b7395ca524f4251f6eefe91e502b086ab0 (patch) | |
tree | 9d262a0c05e3f7b0d60133111e1c43c4cdc814ee /spec/models | |
parent | 639cfdc221617f13ee08e673e0b5e51efc344744 (diff) |
Migrate Repository#can_be_merged? to Gitaly
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/repository_spec.rb | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index c0db2c1b386..859b53ac560 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -358,28 +358,38 @@ describe Repository do end describe '#can_be_merged?' do - context 'mergeable branches' do - subject { repository.can_be_merged?('0b4bc9a49b562e85de7cc9e834518ea6828729b9', 'master') } + shared_examples 'can be merged' do + context 'mergeable branches' do + subject { repository.can_be_merged?('0b4bc9a49b562e85de7cc9e834518ea6828729b9', 'master') } - it { is_expected.to be_truthy } - end + it { is_expected.to be_truthy } + end - context 'non-mergeable branches' do - subject { repository.can_be_merged?('bb5206fee213d983da88c47f9cf4cc6caf9c66dc', 'feature') } + context 'non-mergeable branches' do + subject { repository.can_be_merged?('bb5206fee213d983da88c47f9cf4cc6caf9c66dc', 'feature') } - it { is_expected.to be_falsey } - end + it { is_expected.to be_falsey } + end - context 'non merged branch' do - subject { repository.merged_to_root_ref?('fix') } + context 'non merged branch' do + subject { repository.merged_to_root_ref?('fix') } - it { is_expected.to be_falsey } + it { is_expected.to be_falsey } + end + + context 'non existent branch' do + subject { repository.merged_to_root_ref?('non_existent_branch') } + + it { is_expected.to be_nil } + end end - context 'non existent branch' do - subject { repository.merged_to_root_ref?('non_existent_branch') } + context 'when Gitaly can_be_merged feature is enabled' do + it_behaves_like 'can be merged' + end - it { is_expected.to be_nil } + context 'when Gitaly can_be_merged feature is disabled', :disable_gitaly do + it_behaves_like 'can be merged' end end |