2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
describe Gitlab::Checks::ForcePush do
|
2018-11-08 19:23:39 +05:30
|
|
|
set(:project) { create(:project, :repository) }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
describe '.force_push?' do
|
|
|
|
it 'returns false if the repo is empty' do
|
|
|
|
allow(project).to receive(:empty_repo?).and_return(true)
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
expect(described_class.force_push?(project, 'HEAD', 'HEAD~')).to be(false)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'checks if old rev is an anchestor' do
|
|
|
|
expect(described_class.force_push?(project, 'HEAD', 'HEAD~')).to be(true)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|