2016-12-09 05:22:20 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-07-10 10:24:02 -04:00
|
|
|
describe Gitlab::Checks::ForcePush do
|
2018-06-19 09:01:36 -04:00
|
|
|
set(:project) { create(:project, :repository) }
|
2016-12-09 05:22:20 -05:00
|
|
|
|
2018-06-19 09:01:36 -04:00
|
|
|
describe '.force_push?' do
|
|
|
|
it 'returns false if the repo is empty' do
|
|
|
|
allow(project).to receive(:empty_repo?).and_return(true)
|
2016-12-09 05:22:20 -05:00
|
|
|
|
2018-06-19 09:01:36 -04:00
|
|
|
expect(described_class.force_push?(project, 'HEAD', 'HEAD~')).to be(false)
|
2016-12-09 05:22:20 -05:00
|
|
|
end
|
|
|
|
|
2018-06-19 09:01:36 -04:00
|
|
|
it 'checks if old rev is an anchestor' do
|
|
|
|
expect(described_class.force_push?(project, 'HEAD', 'HEAD~')).to be(true)
|
2016-12-09 05:22:20 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|