debian-mirror-gitlab/spec/lib/gitlab/checks/force_push_spec.rb

20 lines
529 B
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Gitlab::Checks::ForcePush do
2020-04-08 14:13:33 +05:30
let_it_be(: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